<?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 Top and Bottom 5 with RANKX based on other measures in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-and-Bottom-5-with-RANKX-based-on-other-measures/m-p/2493364#M68724</link>
    <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to calculate a top and bottom 5 employees based on the result of two measures.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to use RANKX but the problem is that I need to take into account two measures. Like a double ranking...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below 3 examples:&lt;/P&gt;&lt;P&gt;'Collis checked' and 'Total Over Picking' are measures&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV&gt;&lt;STRONG&gt;1)&amp;nbsp;&lt;img /&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;2)&amp;nbsp;&lt;img /&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;3)&amp;nbsp;&lt;img /&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV&gt;&lt;STRONG&gt;1) &lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Show the BOTTOM 5 'GOLD numbers bereider' with the &lt;U&gt;most&lt;/U&gt;&amp;nbsp;'total over picking'.&lt;/STRONG&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;(!) Take into consideration who has the most 'collis checked'.&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;(!) Total over picking can be BLANK or contain a number&lt;/STRONG&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;In the example left this is the desired result:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;1. 294&lt;/DIV&gt;&lt;DIV&gt;2. 311&lt;/DIV&gt;&lt;DIV&gt;3. 450&lt;/DIV&gt;&lt;DIV&gt;4. 844&lt;/DIV&gt;&lt;DIV&gt;5. blank&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;2) &lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Show the TOP 5 'GOLD numbers bereider' with the &lt;U&gt;less&lt;/U&gt;&amp;nbsp;'total over picking'.&lt;/STRONG&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;(!) Take into consideration who has the most 'collis checked'.&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;(!) Total over picking can be BLANK or contain a number&lt;/STRONG&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;In the example left this is the desired result:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;1. 065&lt;/DIV&gt;&lt;DIV&gt;2. 431&lt;/DIV&gt;&lt;DIV&gt;3. 942&lt;/DIV&gt;&lt;DIV&gt;4. 248&lt;/DIV&gt;&lt;DIV&gt;5. 816&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;3) &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Show the TOP 5 'GOLD numbers bereider' with the &lt;U&gt;less&lt;/U&gt;&amp;nbsp;'total over picking'.&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;STRONG&gt;(!) Take into consideration who has the most 'collis checked'.&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;(!) Total over picking can be BLANK or contain a number&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;In the example left this is the desired result:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;1. 696&lt;/DIV&gt;&lt;DIV&gt;2. 487&lt;/DIV&gt;&lt;DIV&gt;3. 140&lt;/DIV&gt;&lt;DIV&gt;4. 051&lt;/DIV&gt;&lt;DIV&gt;5. 722&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a test powerbi file with sample data.&amp;nbsp;You can download the test file via this link in WeTransfer: &lt;A href="https://we.tl/t-tr6d0dzIQH" target="_blank"&gt;https://we.tl/t-tr6d0dzIQH&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope someone can help out. I already broke my head hours on this one... &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 May 2022 12:32:22 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2022-05-04T12:32:22Z</dc:date>
    <item>
      <title>Top and Bottom 5 with RANKX based on other measures</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-and-Bottom-5-with-RANKX-based-on-other-measures/m-p/2493364#M68724</link>
      <description>&lt;P&gt;Hi all,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need to calculate a top and bottom 5 employees based on the result of two measures.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to use RANKX but the problem is that I need to take into account two measures. Like a double ranking...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below 3 examples:&lt;/P&gt;&lt;P&gt;'Collis checked' and 'Total Over Picking' are measures&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV&gt;&lt;STRONG&gt;1)&amp;nbsp;&lt;img /&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;2)&amp;nbsp;&lt;img /&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;3)&amp;nbsp;&lt;img /&gt;&lt;/STRONG&gt;&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV&gt;&lt;STRONG&gt;1) &lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Show the BOTTOM 5 'GOLD numbers bereider' with the &lt;U&gt;most&lt;/U&gt;&amp;nbsp;'total over picking'.&lt;/STRONG&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;(!) Take into consideration who has the most 'collis checked'.&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;(!) Total over picking can be BLANK or contain a number&lt;/STRONG&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;In the example left this is the desired result:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;1. 294&lt;/DIV&gt;&lt;DIV&gt;2. 311&lt;/DIV&gt;&lt;DIV&gt;3. 450&lt;/DIV&gt;&lt;DIV&gt;4. 844&lt;/DIV&gt;&lt;DIV&gt;5. blank&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;2) &lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;Show the TOP 5 'GOLD numbers bereider' with the &lt;U&gt;less&lt;/U&gt;&amp;nbsp;'total over picking'.&lt;/STRONG&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;(!) Take into consideration who has the most 'collis checked'.&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;(!) Total over picking can be BLANK or contain a number&lt;/STRONG&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;In the example left this is the desired result:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;1. 065&lt;/DIV&gt;&lt;DIV&gt;2. 431&lt;/DIV&gt;&lt;DIV&gt;3. 942&lt;/DIV&gt;&lt;DIV&gt;4. 248&lt;/DIV&gt;&lt;DIV&gt;5. 816&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;STRONG&gt;3) &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Show the TOP 5 'GOLD numbers bereider' with the &lt;U&gt;less&lt;/U&gt;&amp;nbsp;'total over picking'.&lt;/STRONG&gt;&lt;/P&gt;&lt;DIV&gt;&lt;STRONG&gt;(!) Take into consideration who has the most 'collis checked'.&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;(!) Total over picking can be BLANK or contain a number&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;In the example left this is the desired result:&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;1. 696&lt;/DIV&gt;&lt;DIV&gt;2. 487&lt;/DIV&gt;&lt;DIV&gt;3. 140&lt;/DIV&gt;&lt;DIV&gt;4. 051&lt;/DIV&gt;&lt;DIV&gt;5. 722&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created a test powerbi file with sample data.&amp;nbsp;You can download the test file via this link in WeTransfer: &lt;A href="https://we.tl/t-tr6d0dzIQH" target="_blank"&gt;https://we.tl/t-tr6d0dzIQH&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope someone can help out. I already broke my head hours on this one... &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 12:32:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-and-Bottom-5-with-RANKX-based-on-other-measures/m-p/2493364#M68724</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-04T12:32:22Z</dc:date>
    </item>
    <item>
      <title>Re: Top and Bottom 5 with RANKX based on other measures</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-and-Bottom-5-with-RANKX-based-on-other-measures/m-p/2494869#M68794</link>
      <description>&lt;P&gt;Anonymous&lt;/LI-USER&gt; , File seem to have some different data. you need try like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;top and bottom 5 = CALCULATE([Total Over picking],TOPN(5,ALLSELECTED(Data[CODPRE]),[Total Over picking],DESC),VALUES(Data[CODPRE]))+ CALCULATE([Total Over picking],TOPN(5,ALLSELECTED(Data[CODPRE]),[Total Over picking],ASC),VALUES(Data[CODPRE]))&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 05 May 2022 04:24:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-and-Bottom-5-with-RANKX-based-on-other-measures/m-p/2494869#M68794</guid>
      <dc:creator>amitchandak</dc:creator>
      <dc:date>2022-05-05T04:24:16Z</dc:date>
    </item>
    <item>
      <title>Re: Top and Bottom 5 with RANKX based on other measures</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-and-Bottom-5-with-RANKX-based-on-other-measures/m-p/2496429#M68893</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="148838" data-lia-user-login="amitchandak" class="lia-mention lia-mention-user"&gt;amitchandak&lt;/a&gt;&amp;nbsp;, your proposed solution is not exactly what I try to obtain&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;img /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Your 'top and bottom 5' returns the value of the 'total over picking'. I would like it to return a ranking (number 1 to 5).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also if the top 5 of the 'total over picking' contains several times the same value then it should look at the 'collis checked' measure to rank those values.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the left example:&lt;/P&gt;&lt;P&gt;top 5 result would be&amp;nbsp;&lt;/P&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;collis checked&lt;/TD&gt;&lt;TD&gt;total over picking&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;top 5 (ranking)&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;108&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;166&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;5&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;3&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;5&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;337&lt;/TD&gt;&lt;TD&gt;4&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You know how I can do this? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 15:21:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-and-Bottom-5-with-RANKX-based-on-other-measures/m-p/2496429#M68893</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-05T15:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: Top and Bottom 5 with RANKX based on other measures</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-and-Bottom-5-with-RANKX-based-on-other-measures/m-p/2504151#M69294</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;Anonymous&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your last requirement, please try formula as below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Ranking = 
RANKX (
    ALLSELECTED( Data[CODPRE] ),
    RANKX ( ALLSELECTED( Data[CODPRE] ), [Total Over picking],,DESC )
        + DIVIDE (
            RANKX ( ALLSELECTED( Data[CODPRE] ), [Collis checked],,DESC ),
            COUNTROWS ( ALLSELECTED( Data[CODPRE] ) ) + 1
        )
        ,,
    ASC,
    DENSE
)&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Ranking(&amp;lt;5) = 
IF([Ranking]&amp;lt;=5,[Ranking],BLANK())&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Please check my sample file for more details.&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Community Support Team _ Eason&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 08:55:33 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-and-Bottom-5-with-RANKX-based-on-other-measures/m-p/2504151#M69294</guid>
      <dc:creator>v-easonf-msft</dc:creator>
      <dc:date>2022-05-10T08:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: Top and Bottom 5 with RANKX based on other measures</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-and-Bottom-5-with-RANKX-based-on-other-measures/m-p/2504913#M69333</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="192401" data-lia-user-login="v-easonf-msft" class="lia-mention lia-mention-user"&gt;v-easonf-msft&lt;/a&gt;! That measure is exactly what I needed!&lt;BR /&gt;Would never have been able to figure that out all by myself&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":flushed_face:"&gt;😳&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 May 2022 13:02:53 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Top-and-Bottom-5-with-RANKX-based-on-other-measures/m-p/2504913#M69333</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-05-10T13:02:53Z</dc:date>
    </item>
  </channel>
</rss>

