<?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: Ranking by a measure and default &amp;quot;Others&amp;quot; as the last one of the ranking in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-a-measure-and-default-quot-Others-quot-as-the-last/m-p/2714812#M82619</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes this is what I need!!!&lt;/P&gt;&lt;P&gt;Thank you tamerj1, and sorry for the late reply. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Chelsea&lt;/P&gt;</description>
    <pubDate>Sun, 21 Aug 2022 11:35:11 GMT</pubDate>
    <dc:creator>Chelsea_Yu</dc:creator>
    <dc:date>2022-08-21T11:35:11Z</dc:date>
    <item>
      <title>Ranking by a measure and default "Others" as the last one of the ranking</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-a-measure-and-default-quot-Others-quot-as-the-last/m-p/2602192#M75252</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Your help on this will be appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;There are 2 tables and I wanna creat a ranking measure that rank by "Net Sales"&amp;nbsp;measure for "Group".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Net Sales = SUM(Sales) - SUM(Returns)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want to see the Group ranking by net sales like below...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;and no matter what amount of net sales does Group "Others" get, always put "Others" at the last one of the ranking.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;How could I write the RANKX DAX ?&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks in advance.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Jun 2022 15:04:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-a-measure-and-default-quot-Others-quot-as-the-last/m-p/2602192#M75252</guid>
      <dc:creator>Chelsea_Yu</dc:creator>
      <dc:date>2022-06-26T15:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking by a measure and default "Others" as the last one of the ranking</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-a-measure-and-default-quot-Others-quot-as-the-last/m-p/2602267#M75259</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="405661" data-lia-user-login="Chelsea_Yu" class="lia-mention lia-mention-user"&gt;Chelsea_Yu&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you my try&lt;/P&gt;&lt;P&gt;RANKX (&lt;BR /&gt;VALUES ( Channel[Groups] ),&lt;/P&gt;&lt;P&gt;IF (&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Channel[Groups] = "Others",&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;0,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;[Net Sales]&lt;BR /&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Jun 2022 17:43:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-a-measure-and-default-quot-Others-quot-as-the-last/m-p/2602267#M75259</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-06-26T17:43:14Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking by a measure and default "Others" as the last one of the ranking</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-a-measure-and-default-quot-Others-quot-as-the-last/m-p/2608098#M75547</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="405661" data-lia-user-login="Chelsea_Yu" class="lia-mention lia-mention-user"&gt;Chelsea_Yu&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may try this Calculated column.&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Ranking =
VAR rankExceptOthers =
    RANKX (
        FILTER ( 'Channel table', 'Channel table'[Group] &amp;lt;&amp;gt; "Others" ),
        CALCULATE('Channel table'[Net Sales],ALLEXCEPT('Channel table','Channel table'[Group])),
        ,
        DESC,
        DENSE
    )
VAR countGroup =
    CALCULATE ( DISTINCTCOUNT ( 'Channel table'[Group] ), ALL ( 'Channel table' ) )
RETURN
    IF ( 'Channel table'[Group] = "Others", countGroup, rankExceptOthers )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The result looks like this.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, attached the pbix file as reference.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is any post helps, then please consider&lt;STRONG&gt; Accept it as the solution&lt;/STRONG&gt; to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;
&lt;P&gt;Community Support Team _ Caiyun&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 01:31:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-a-measure-and-default-quot-Others-quot-as-the-last/m-p/2608098#M75547</guid>
      <dc:creator>v-cazheng-msft</dc:creator>
      <dc:date>2022-06-29T01:31:23Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking by a measure and default "Others" as the last one of the ranking</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-a-measure-and-default-quot-Others-quot-as-the-last/m-p/2614120#M75886</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN&gt;Caiyun,&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="277465" data-lia-user-login="v-cazheng-msft" class="lia-mention lia-mention-user"&gt;v-cazheng-msft&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for your reply.&lt;BR /&gt;But I've found that it dosen't work when I want to rank the group within a certain period of time.&lt;BR /&gt;Please refer to the table below, the ranking is not accroding to the net sales during 5/13 - 5/31.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;Your reply seems pretty close to the solution, could the way may be creating a ranking measure by temp table in dax instead of a column ?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Chelsea&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2022 11:40:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-a-measure-and-default-quot-Others-quot-as-the-last/m-p/2614120#M75886</guid>
      <dc:creator>Chelsea_Yu</dc:creator>
      <dc:date>2022-07-01T11:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking by a measure and default "Others" as the last one of the ranking</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-a-measure-and-default-quot-Others-quot-as-the-last/m-p/2614214#M75891</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="405661" data-lia-user-login="Chelsea_Yu" class="lia-mention lia-mention-user"&gt;Chelsea_Yu&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Please use the following measure&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Rank = 
VAR ThisGroup = SELECTEDVALUE ( 'Channel table'[Group] )
VAR Ranking =
    RANKX ( 
        FILTER ( ALLSELECTED ( 'Channel table'[Group] ), 'Channel table'[Group] &amp;lt;&amp;gt; "Others" ),
        [Net Sales]
    )
RETURN
    IF ( ThisGroup = "Others", Ranking + 1, Ranking )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Another method:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Rank = 
VAR ThisGroup = SELECTEDVALUE ( 'Channel table'[Group] )
VAR SelectedGroups = ALLSELECTED ( 'Channel table'[Group] )
VAR T1 = 
    ADDCOLUMNS ( 
        SelectedGroups, 
        "@Rank",
        RANKX ( 
            FILTER ( ALLSELECTED ( 'Channel table'[Group] ), 'Channel table'[Group] &amp;lt;&amp;gt; "Others" ),
            [Net Sales]
        )
    )
VAR CurrentRank = 
    RANKX ( 
        FILTER ( ALLSELECTED ( 'Channel table'[Group] ), 'Channel table'[Group] &amp;lt;&amp;gt; "Others" ),
        [Net Sales]
    )
VAR MaxRank = MAXX ( T1, [@Rank] )
RETURN
    IF ( ThisGroup = "Others", MaxRank + 1, CurrentRank )&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2022 13:01:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-a-measure-and-default-quot-Others-quot-as-the-last/m-p/2614214#M75891</guid>
      <dc:creator>tamerj1</dc:creator>
      <dc:date>2022-07-01T13:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: Ranking by a measure and default "Others" as the last one of the ranking</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-a-measure-and-default-quot-Others-quot-as-the-last/m-p/2714812#M82619</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="317289" data-lia-user-login="tamerj1" class="lia-mention lia-mention-user"&gt;tamerj1&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes this is what I need!!!&lt;/P&gt;&lt;P&gt;Thank you tamerj1, and sorry for the late reply. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Chelsea&lt;/P&gt;</description>
      <pubDate>Sun, 21 Aug 2022 11:35:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Ranking-by-a-measure-and-default-quot-Others-quot-as-the-last/m-p/2714812#M82619</guid>
      <dc:creator>Chelsea_Yu</dc:creator>
      <dc:date>2022-08-21T11:35:11Z</dc:date>
    </item>
  </channel>
</rss>

