<?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: Determine rank of distinct count of values with filter in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Determine-rank-of-distinct-count-of-values-with-filter/m-p/1391766#M25526</link>
    <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;Try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rank = RANKX(ALL(myTable),[Count],,DESC,Dense)&lt;/LI-CODE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rank = RANKX(ALLSELECTED(myTable),[Count],,DESC,Dense)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Sep 2020 03:12:31 GMT</pubDate>
    <dc:creator>Greg_Deckler</dc:creator>
    <dc:date>2020-09-24T03:12:31Z</dc:date>
    <item>
      <title>Determine rank of distinct count of values with filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Determine-rank-of-distinct-count-of-values-with-filter/m-p/1390261#M25471</link>
      <description>&lt;P&gt;Hi Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to calculate the rank of the number of occurrences taking place of email addresses. However, while calculating the rank I also want to ensure a filter is applied (based on who has attended). Below is an example of my dataset&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;Forum&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Email&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;Attended&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Forum 1&lt;/TD&gt;&lt;TD&gt;&lt;A href="mailto:aa@abc.com" target="_blank" rel="noopener"&gt;aa@abc.com&lt;/A&gt;&lt;/TD&gt;&lt;TD&gt;Attended&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Forum 2&lt;/TD&gt;&lt;TD&gt;&lt;A href="mailto:aa@abc.com" target="_blank" rel="noopener"&gt;aa@abc.com&lt;/A&gt;&lt;/TD&gt;&lt;TD&gt;Not Attended&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Forum 1&lt;/TD&gt;&lt;TD&gt;&lt;A href="mailto:bb@abc.com" target="_blank" rel="noopener"&gt;bb@abc.com&lt;/A&gt;&lt;/TD&gt;&lt;TD&gt;Attended&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Forum 3&lt;/TD&gt;&lt;TD&gt;&lt;A href="mailto:cc@abc.com" target="_blank" rel="noopener"&gt;cc@abc.com&lt;/A&gt;&lt;/TD&gt;&lt;TD&gt;Attended&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Forum 1&lt;/TD&gt;&lt;TD&gt;&lt;A href="mailto:cc@abc.com" target="_blank" rel="noopener"&gt;cc@abc.com&lt;/A&gt;&lt;/TD&gt;&lt;TD&gt;Not Attended&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Forum 2&lt;/TD&gt;&lt;TD&gt;&lt;A href="mailto:cc@abc.com" target="_blank" rel="noopener"&gt;cc@abc.com&lt;/A&gt;&lt;/TD&gt;&lt;TD&gt;Attended&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the above table, the result should show &lt;A href="mailto:cc@abc.com" target="_blank" rel="noopener"&gt;cc@abc.com&lt;/A&gt;&amp;nbsp;as Rank 1 as they have attended two forums. However, if I filter on Forum 1, then &lt;A href="mailto:aa@abc.com" target="_blank" rel="noopener"&gt;aa@abc.com&lt;/A&gt;&amp;nbsp;&amp;amp; &lt;A href="mailto:bb@abc.com" target="_blank" rel="noopener"&gt;bb@abc.com&lt;/A&gt;&amp;nbsp;should be rank 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have written a measure which looks as follows:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;RANKX(ALLSELECTED(MyTable),CALCULATE(COUNT(MyTable[Email]),FILTER(ALLEXCEPT(MyTable,Mytable[Email]),MyTable[Attended] = "Attended")),,DESC,Dense)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;However, I'm still not able to get a rank which dynamically changes everytime I change a selection.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Can anyone help me out?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks!&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2020 13:09:51 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Determine-rank-of-distinct-count-of-values-with-filter/m-p/1390261#M25471</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-23T13:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: Determine rank of distinct count of values with filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Determine-rank-of-distinct-count-of-values-with-filter/m-p/1390340#M25474</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt;&amp;nbsp;Despite it's name, this article actually has quite a bit of good knowlege on how to use RANKX:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.powerbi.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/m-p/1042520#M452" target="_blank"&gt;https://community.powerbi.com/t5/Quick-Measures-Gallery/To-Bleep-with-RANKX/m-p/1042520#M452&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;@ me if you still need assistance.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2020 13:44:10 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Determine-rank-of-distinct-count-of-values-with-filter/m-p/1390340#M25474</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-09-23T13:44:10Z</dc:date>
    </item>
    <item>
      <title>Re: Determine rank of distinct count of values with filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Determine-rank-of-distinct-count-of-values-with-filter/m-p/1391232#M25510</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&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;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for sharing this across. I've tried to troubleshoot it using the guide, however, I'm still facing an issue with the ranks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So what I've tried to also do is break up the calculation into 2 measures: the first one calculates the count with the underlying filter logic, and the second measure ranks the count calculated from the first. I've rewritten the formulas below:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Count = CALCULATE(COUNT(myTable[Email]), FILTER('myTable,myTable[Attendance] = "Attended"))&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Rank = RANKX(myTable,[Count],,DESC,Dense)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;What I notice is that the count measure works perfectly as I drill across the dataset, so I'm sure the first formula is correct. But everything shows up as a rank 1 something like below:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;COUNT&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RANK&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; 7&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; 6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; 6&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; 5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; 5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; 5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;When I try combining the two formulas together, I'm getting the same outcome as above. I'm really not sure what I'm doing wrong over here.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 23 Sep 2020 20:30:52 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Determine-rank-of-distinct-count-of-values-with-filter/m-p/1391232#M25510</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-23T20:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Determine rank of distinct count of values with filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Determine-rank-of-distinct-count-of-values-with-filter/m-p/1391766#M25526</link>
      <description>&lt;P&gt;Anonymous&lt;/a&gt;&amp;nbsp;Try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rank = RANKX(ALL(myTable),[Count],,DESC,Dense)&lt;/LI-CODE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rank = RANKX(ALLSELECTED(myTable),[Count],,DESC,Dense)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 03:12:31 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Determine-rank-of-distinct-count-of-values-with-filter/m-p/1391766#M25526</guid>
      <dc:creator>Greg_Deckler</dc:creator>
      <dc:date>2020-09-24T03:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: Determine rank of distinct count of values with filter</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Determine-rank-of-distinct-count-of-values-with-filter/m-p/1392136#M25530</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&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;yeah I tried your versions of the formula as well, but I'm unfortunately getting the same results.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did however, manage to find this &lt;A href="https://community.powerbi.com/t5/Desktop/Ranking-a-measure/td-p/539066" target="_self"&gt;article&lt;/A&gt; which seemed to be doing the trick. From the formulas marked as the solution, I took the version which creates temporary tables, and I changed the sum calculations in the 'summry' table to the count formula I had.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't think I would have ever gotten to that answer by myself&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_with_tears_of_joy:"&gt;😂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 06:42:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Determine-rank-of-distinct-count-of-values-with-filter/m-p/1392136#M25530</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-09-24T06:42:14Z</dc:date>
    </item>
  </channel>
</rss>

