title: Magento 2 custom column sorting not working
body: <p>I have created custom column in <code>Sales -&gt; Order</code> <strong>UI Grid</strong>. I have added <strong>"Profit"</strong> column. Which is not related to any database table and not the attribute. This column display just calculation of profit.</p>
  
  <p>The issue is I can not sort the column. Column is sortable but it is sorting incorrectly.</p>
  
  <p>I have checked many similar question in stack but nothing helpfull. As the column is not in table and not the attribute.</p>
  
  <p>Following is my override file.</p>
  
  <p><strong>sales_order_grid.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd"&gt;
      &lt;columns name="sales_order_columns"&gt;
          &lt;column name="total_paid" class="Company\Module\Ui\Component\Listing\Column\PurchasedPrice"&gt;
              &lt;argument name="data" xsi:type="array"&gt;
                  &lt;item name="config" xsi:type="array"&gt;
                      &lt;item name="label" xsi:type="string" translate="true"&gt;Profit&lt;/item&gt;
                      &lt;item name="sortOrder" xsi:type="number"&gt;13&lt;/item&gt;
                  &lt;/item&gt;
              &lt;/argument&gt;
  
          &lt;/column&gt;
      &lt;/columns&gt;
  &lt;/listing&gt;
  </code></pre>