<?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: To *Bleep* with RANKX! in Quick Measures Gallery</title>
    <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/m-p/3208845#M974</link>
    <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;, I'm having trouble with getting this to work (specifically the last formula).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of the rank, I'm simply getting a count of all the distinct groups that have sales for a particular product.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have logged a post here:&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Desktop/Summarized-Ranking-with-RLS/td-p/3204959" target="_blank" rel="noopener"&gt;https://community.powerbi.com/t5/Desktop/Summarized-Ranking-with-RLS/td-p/3204959&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would really appreciate some help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;</description>
    <pubDate>Thu, 27 Apr 2023 08:40:24 GMT</pubDate>
    <dc:creator>Kniggit270</dc:creator>
    <dc:date>2023-04-27T08:40:24Z</dc:date>
    <item>
      <title>To *Bleep* with RANKX!</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/m-p/1042520#M452</link>
      <description>&lt;P&gt;Perhaps no other function in the DAX language has caused more grief and strife than RANKX (other than perhaps the entire suite of time "intelligence" functions). Not a day goes by in the forums that there are not multiple questions about how RANKX works. And there are pages upon pages upon pages of blog articles explaining RANKX's intricacies. So, similar to &lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TITHW/td-p/434008" target="_self"&gt;Time Intelligence the Hard Way&lt;/A&gt;, the question we must ask ourselves is, why bother? Does RANKX just exist to give bloggers something to write about? In reality, the RANKX function really doesn't do anything that can't be done with base DAX functions with much less arcane syntax and hoops to jump through. So, to *bleep* with RANKX! We don't need it!&lt;/P&gt;
&lt;P&gt;A simple column Rank can be achieved using COUNTROWS:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ToHellWithRankXDesc = COUNTROWS(FILTER('Table',[Value]&amp;gt;=EARLIER([Value])))

ToHellWithRankXAsc = COUNTROWS(FILTER('Table',[Value]&amp;lt;=EARLIER([Value])))&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The equivalent columns in RANKX are:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;RankXDesc = RANKX('Table',[Value],,DESC)

RankXAsc = RANKX('Table',[Value],,ASC)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We can also use measures to achieve rankings much more intuitively by any combination of categories and subcategories:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;ToHellWithRankXDescMeasure = 
    COUNTROWS(
        FILTER(
            ALL('Table'),
            [Value]&amp;gt;=SUM([Value])
        )
    )

ToHellWithRankXDescMeasure2 = 
    COUNTROWS(
        FILTER(
            SUMMARIZE(
                ALL('Table'),
                [Group],
                "Value",SUM('Table'[Value])
            ),
            [Value]&amp;gt;=SUM([Value])
        )
    )

ToHellWithRankXDescMeasure3 = 
    COUNTROWS(
        FILTER(
            SUMMARIZE(
                FILTER(
                    ALL('Table'),
                    [Group] = MAX([Group])
                ),
                [Item],
                "Value",SUM('Table'[Value])
            ),
            [Value]&amp;gt;=SUM([Value])
        )
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Simple, logical, no crazy putting CALCULATE in places that do not make intuitive sense, remembering which parameter you probably don't want to ever use (it's the third one), remembering some hokey key word like ASC and DESC or struggling with how many different columns to wrap an ALL around; just plain old standard table filtering...&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;NOTE: The answer to the above speculation and rant is that RANKX is actually highly performant compared to using COUNTROWS and FILTER. You try ranking 100,000 rows using COUNTROWS and FILTER and you will likely be very sad. But who ranks that many rows anyway?&lt;/EM&gt;&lt;/STRONG&gt; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Here are the equivalent RANKX measures:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;RankXDescMeasure = 
    RANKX(
        ALL('Table'),
        CALCULATE(
            SUM('Table'[Value])
        ),
        ,
        DESC
    )

RankXDescMeasure2 = 
    RANKX(
        ALL('Table'[Group]),
        CALCULATE(
            SUM('Table'[Value])
        ),
        ,
        DESC
    )

RankXDescMeasure3 = 
    RANKX(
        FILTER(
            ALL(
                'Table'[Group],
                'Table'[Item]
            ),
            'Table'[Group] = MAX('Table'[Group])
        ),
        CALCULATE(SUM('Table'[Value]))
        ,
        ,DESC
    )&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="reportid hidden"&gt;eyJrIjoiMWEzNWQ0MGUtNGQ2Ny00NDdiLWJmYTMtZTU0ZjZkNThmZDU0IiwidCI6IjRhMDQyNzQzLTM3M2EtNDNkMi04MjdiLTAwM2Y0YzdiYTFlNSIsImMiOjN9&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2020 05:48:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/m-p/1042520#M452</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-04-24T05:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: To *Bleep* with RANKX!</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/m-p/1049388#M455</link>
      <description>&lt;P style="padding-left: 30px;"&gt;Doesn't give the same results as RANKX when there are ties. Or am I missing something? Thanks&lt;/P&gt;
&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 100%;" border="1"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD style="width: 25%;"&gt;Person&lt;/TD&gt;
&lt;TD style="width: 25%;"&gt;Total Calls&lt;/TD&gt;
&lt;TD style="width: 25%;"&gt;ToHellWithRankXDesc&lt;/TD&gt;
&lt;TD style="width: 25%;"&gt;RANKX&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 25%;"&gt;B&lt;/TD&gt;
&lt;TD style="width: 25%;"&gt;220&lt;/TD&gt;
&lt;TD style="width: 25%;"&gt;1&lt;/TD&gt;
&lt;TD style="width: 25%;"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 25%;"&gt;A&lt;/TD&gt;
&lt;TD style="width: 25%;"&gt;160&lt;/TD&gt;
&lt;TD style="width: 25%;"&gt;3&lt;/TD&gt;
&lt;TD style="width: 25%;"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD style="width: 25%;"&gt;C&lt;/TD&gt;
&lt;TD style="width: 25%;"&gt;160&lt;/TD&gt;
&lt;TD style="width: 25%;"&gt;3&lt;/TD&gt;
&lt;TD style="width: 25%;"&gt;2&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Apr 2020 01:16:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/m-p/1049388#M455</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-04-27T01:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: To *Bleep* with RANKX!</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/m-p/1070751#M501</link>
      <description>Depends on the parameters you provide to RANKX but definitely solvable.</description>
      <pubDate>Tue, 05 May 2020 04:33:59 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/m-p/1070751#M501</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-05-05T04:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: To *Bleep* with RANKX!</title>
      <link>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/m-p/3208845#M974</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="313" data-lia-user-login="Greg_Deckler" class="lia-mention lia-mention-user"&gt;Greg_Deckler&lt;/a&gt;&amp;nbsp;, I'm having trouble with getting this to work (specifically the last formula).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Instead of the rank, I'm simply getting a count of all the distinct groups that have sales for a particular product.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have logged a post here:&amp;nbsp;&lt;A href="https://community.powerbi.com/t5/Desktop/Summarized-Ranking-with-RLS/td-p/3204959" target="_blank" rel="noopener"&gt;https://community.powerbi.com/t5/Desktop/Summarized-Ranking-with-RLS/td-p/3204959&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would really appreciate some help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks&lt;/P&gt;</description>
      <pubDate>Thu, 27 Apr 2023 08:40:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/m-p/3208845#M974</guid>
      <dc:creator>Kniggit270</dc:creator>
      <dc:date>2023-04-27T08:40:24Z</dc:date>
    </item>
  </channel>
</rss>

