<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: sort a calculated table in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sort-a-calculated-table/m-p/3686955#M143223</link>
    <description>&lt;P&gt;I changed the names for this question don't like to share internal workings at my company&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2024 00:07:15 GMT</pubDate>
    <dc:creator>akhaliq7</dc:creator>
    <dc:date>2024-02-08T00:07:15Z</dc:date>
    <item>
      <title>sort a calculated table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sort-a-calculated-table/m-p/3683778#M143077</link>
      <description>&lt;P&gt;I have created a calculated table and would like to sort it using one of the numeric columns following is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Measure = 
 ADDCOLUMNS(
    FILTER(
        VALUES(Table[Column1]),
        'Table'[Column1] &amp;lt;&amp;gt; "Not Provided"
    ),
    "Status", Table[Column1],
    "Color", SWITCH('Table'[Column1], "sold", 1, "delivered", 2, "cancelled", 3, 4)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I add ORDER BY to the above code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Feb 2024 17:58:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sort-a-calculated-table/m-p/3683778#M143077</guid>
      <dc:creator>akhaliq7</dc:creator>
      <dc:date>2024-02-06T17:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: sort a calculated table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sort-a-calculated-table/m-p/3684253#M143098</link>
      <description>&lt;P&gt;I wouldn't want to call my calculated table "Measure" &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just add the ORDER BY at the end.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2024 00:41:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sort-a-calculated-table/m-p/3684253#M143098</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-02-07T00:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: sort a calculated table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sort-a-calculated-table/m-p/3684831#M143123</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="307422" data-lia-user-login="akhaliq7" class="lia-mention lia-mention-user"&gt;akhaliq7&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope everything is going well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on your description, it can be seen that you want to rename the existing column1 to "Status", then assign different Colors to different Statuses, and finally sort according to Color.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To achieve your needs, please follow my steps below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Enter Power Query to perform data cleaning, for example, rename Column1 to Status, select the Status column and right-click the two options in the screenshot below.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add Column&amp;gt;&amp;gt;Conditional Column&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After setting, click Close and Apply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The ORDER BY function is used in DAX queries, and the syntax is as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At this point, you can sort the Status by color. The default is ascending order.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;pbix file is attached.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have any other questions please feel free to contact me, thank you for your patience and waiting.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;EVALUATE
     ADDCOLUMNS(
         FILTER(VALUES('Table'[Status]),'Table'[Status] &amp;lt;&amp;gt; "Not Provided"),
         "Color", SWITCH('Table'[Status], "sold", 1, "delivered", 2, "cancelled", 3, 4)
     )
ORDER BY [Color]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yang&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Thanks a lot!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2024 06:43:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sort-a-calculated-table/m-p/3684831#M143123</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-07T06:43:53Z</dc:date>
    </item>
    <item>
      <title>Re: sort a calculated table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sort-a-calculated-table/m-p/3686955#M143223</link>
      <description>&lt;P&gt;I changed the names for this question don't like to share internal workings at my company&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 00:07:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sort-a-calculated-table/m-p/3686955#M143223</guid>
      <dc:creator>akhaliq7</dc:creator>
      <dc:date>2024-02-08T00:07:15Z</dc:date>
    </item>
    <item>
      <title>Re: sort a calculated table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sort-a-calculated-table/m-p/3686957#M143224</link>
      <description>&lt;P&gt;I tried doing this but did not work and also when creating a calculated table cannot use evaluated, can only use evaluate in dax studio&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 00:08:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sort-a-calculated-table/m-p/3686957#M143224</guid>
      <dc:creator>akhaliq7</dc:creator>
      <dc:date>2024-02-08T00:08:26Z</dc:date>
    </item>
    <item>
      <title>Re: sort a calculated table</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sort-a-calculated-table/m-p/3713009#M144479</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="307422" data-lia-user-login="akhaliq7" class="lia-mention lia-mention-user"&gt;akhaliq7&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for your reply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you need to follow the steps below and then you can use EVALUATE.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, select File&amp;gt;&amp;gt;Options and Settings&amp;gt;&amp;gt;Options&amp;gt;&amp;gt;Preview features&amp;gt;&amp;gt;DAX query view.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After enabling this feature, restart your Power BI Desktop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;At this point, the function tab on the left has this.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now you can put my expression in here and run it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have any further questions please feel free to contact me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Yang&lt;BR /&gt;Community Support Team&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;helps&lt;/EM&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Accept it as the solution&lt;/EM&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;to help the other members find it more quickly.&lt;BR /&gt;If I misunderstand your needs or you still have problems on it, please feel free to let us know.&amp;nbsp;&lt;STRONG&gt;&lt;EM&gt;Thanks a lot!&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2024 04:31:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/sort-a-calculated-table/m-p/3713009#M144479</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-02-21T04:31:49Z</dc:date>
    </item>
  </channel>
</rss>

