<?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: How to make RANKX work for columns/different categories in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1540796#M30316</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92178" data-lia-user-login="AlB" class="lia-mention lia-mention-user"&gt;AlB&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thank you for the reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It doesn't work, it gives me this error. I am not sure if I can have 'AA_Master Data'[FieldInColumns] within CALCULATE without ALL/ALLSELECTED/VALUES etc. If I use them, then the result is incorrect, same as in original post.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Dec 2020 11:49:43 GMT</pubDate>
    <dc:creator>Tomfiki</dc:creator>
    <dc:date>2020-12-09T11:49:43Z</dc:date>
    <item>
      <title>How to make RANKX work for columns/different categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1539327#M30274</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could you please help me get this DAX formula working?&lt;/P&gt;&lt;P&gt;I need a formula which will always display result for Customer Group by total sales for that customer (e.g. for top 3 customers).&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I tried to use this one (CMN = Customer):&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;EM&gt;Sales_byGroup = CALCULATE([SALES+RoFo],&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;FILTER(VALUES('AA_Master Data'[CMN]),&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; COUNTROWS(FILTER(Customer_Groups,&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;RANKX(ALL('AA_Master Data'[CMN]),[SALES+RoFo],,DESC)&amp;gt;=Customer_Groups[Min_CustGroup] &amp;amp;&amp;amp;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;RANKX(ALL('AA_Master Data'[CMN]),[SALES+RoFo],,DESC)&amp;lt;=Customer_Groups[Max_CustGroups])) &amp;gt;0))&lt;/EM&gt;&lt;/PRE&gt;&lt;DIV&gt;&lt;SPAN&gt;But, as you can see from the picture, it gives me result for top 3 values per each category - red brackets - e.g. top 3 CMN values in MSGE group, then top 3 values in FCGE group etc... what I need is MSGE sales for top 3 CMN (customers) - green bracket. Then it would do the same for 3.-10, customer and so on.&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;img /&gt;I'll be gratefull for any help.&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Tomas&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;I am sorry but I cannot share the .pbix file. I can make more print-screens if required.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 19:59:17 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1539327#M30274</guid>
      <dc:creator>Tomfiki</dc:creator>
      <dc:date>2020-12-08T19:59:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to make RANKX work for columns/different categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1539405#M30278</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="271432" data-lia-user-login="Tomfiki" class="lia-mention lia-mention-user"&gt;Tomfiki&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sales_byGroup =
CALCULATE (
    [SALES+RoFo],
    FILTER (
        VALUES ( 'AA_Master Data'[CMN] ),
        COUNTROWS (
            FILTER (
                Customer_Groups,
                RANKX (
                    ALL ( 'AA_Master Data'[CMN] ),
                    CALCULATE ( [SALES+RoFo], 'AA_Master Data'[FieldInColumns] ),
                    ,
                    DESC
                ) &amp;gt;= Customer_Groups[Min_CustGroup]
                    &amp;amp;&amp;amp; RANKX (
                        ALL ( 'AA_Master Data'[CMN] ),
                        CALCULATE ( [SALES+RoFo], 'AA_Master Data'[FieldInColumns] ),
                        ,
                        DESC
                    ) &amp;lt;= Customer_Groups[Max_CustGroups]
            )
        ) &amp;gt; 0
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;where 'AA_Master Data'[FieldInColumns] is, well, the field you have in the columns of your matrix visual&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2020 21:24:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1539405#M30278</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-12-08T21:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to make RANKX work for columns/different categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1540796#M30316</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92178" data-lia-user-login="AlB" class="lia-mention lia-mention-user"&gt;AlB&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thank you for the reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It doesn't work, it gives me this error. I am not sure if I can have 'AA_Master Data'[FieldInColumns] within CALCULATE without ALL/ALLSELECTED/VALUES etc. If I use them, then the result is incorrect, same as in original post.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 11:49:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1540796#M30316</guid>
      <dc:creator>Tomfiki</dc:creator>
      <dc:date>2020-12-09T11:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to make RANKX work for columns/different categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1540823#M30317</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="271432" data-lia-user-login="Tomfiki" class="lia-mention lia-mention-user"&gt;Tomfiki&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry. Looks like I forgot to write down the ALLs &lt;span class="lia-unicode-emoji" title=":face_with_rolling_eyes:"&gt;🙄&lt;/span&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sales_byGroup =
CALCULATE (
    [SALES+RoFo],
    FILTER (
        VALUES ( 'AA_Master Data'[CMN] ),
        COUNTROWS (
            FILTER (
                Customer_Groups,
                RANKX (
                    ALL ( 'AA_Master Data'[CMN] ),
                    CALCULATE ( [SALES+RoFo], ALL ( 'AA_Master Data'[FieldInColumns] ) ),
                    ,
                    DESC
                ) &amp;gt;= Customer_Groups[Min_CustGroup]
                    &amp;amp;&amp;amp; RANKX (
                        ALL ( 'AA_Master Data'[CMN] ),
                        CALCULATE ( [SALES+RoFo], ALL ( 'AA_Master Data'[FieldInColumns] ) ),
                        ,
                        DESC
                    ) &amp;lt;= Customer_Groups[Max_CustGroups]
            )
        ) &amp;gt; 0
    )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 12:04:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1540823#M30317</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-12-09T12:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to make RANKX work for columns/different categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1540891#M30323</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92178" data-lia-user-login="AlB" class="lia-mention lia-mention-user"&gt;AlB&lt;/a&gt;&lt;BR /&gt;I've tried your change but it still gives me the same (wrong) result as described in original post.&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 12:34:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1540891#M30323</guid>
      <dc:creator>Tomfiki</dc:creator>
      <dc:date>2020-12-09T12:34:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to make RANKX work for columns/different categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1540934#M30325</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="271432" data-lia-user-login="Tomfiki" class="lia-mention lia-mention-user"&gt;Tomfiki&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Sales_byGroup =
CALCULATE (
    [SALES+RoFo],
    FILTER (
        ALL ( 'AA_Master Data'[CMN] ),
        COUNTROWS (
            FILTER (
                Customer_Groups,
                RANKX (
                    ALL ( 'AA_Master Data'[CMN] ),
                    CALCULATE ( [SALES+RoFo], ALL ( 'AA_Master Data'[FieldInColumns] ) ),
                    ,
                    DESC
                ) &amp;gt;= Customer_Groups[Min_CustGroup]
                    &amp;amp;&amp;amp; RANKX (
                        ALL ( 'AA_Master Data'[CMN] ),
                        CALCULATE ( [SALES+RoFo], ALL ( 'AA_Master Data'[FieldInColumns] ) ),
                        ,
                        DESC
                    ) &amp;lt;= Customer_Groups[Max_CustGroups]
            )
        ) &amp;gt; 0
    )
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 12:59:02 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1540934#M30325</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-12-09T12:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to make RANKX work for columns/different categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1541363#M30348</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92178" data-lia-user-login="AlB" class="lia-mention lia-mention-user"&gt;AlB&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Unfortunatelly, that is still giving me the same wrong result.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 16:27:03 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1541363#M30348</guid>
      <dc:creator>Tomfiki</dc:creator>
      <dc:date>2020-12-09T16:27:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to make RANKX work for columns/different categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1541397#M30355</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="271432" data-lia-user-login="Tomfiki" class="lia-mention lia-mention-user"&gt;Tomfiki&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'd need the pbix or a mock one with dummy/anonymized data that reproduces the issue&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&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;</description>
      <pubDate>Wed, 09 Dec 2020 17:04:38 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1541397#M30355</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-12-09T17:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to make RANKX work for columns/different categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1541490#M30365</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="271432" data-lia-user-login="Tomfiki" class="lia-mention lia-mention-user"&gt;Tomfiki&lt;/a&gt;&amp;nbsp; Assuming you are trying to get top 3 based on the grand total, I have prepared a sample file for you, hopefully this gives you some ideas, since you can't share your file. The file is attached below my signature.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First table calculates top 3 based on the column total and second table calculates top 3 for the respective brand ( column )&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Top 3 = 
VAR N = 3
VAR ColorSales =
    ADDCOLUMNS (
        ALL ( Products[Color] ),
        "@Sales", CALCULATE ( [Total Sales], ALLSELECTED ( Products[Brand] ) )
    )
VAR TopBrands =
    TOPN ( N, ColorSales, [@Sales], DESC )
VAR Result =
    CALCULATE ( [Total Sales], KEEPFILTERS ( TopBrands ) )
RETURN
    Result
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Top 3 2 = 
SUMX (
    VALUES ( Products[Brand] ),
    VAR N = 3
    VAR Result =
        TOPN (
            N,
            CALCULATETABLE (
                ADDCOLUMNS (
                    SUMMARIZE ( Products, Products[Brand], Products[Color] ),
                    "@Sales", [Total Sales]
                ),
                ALL ( Products[Color] )
            ),
            [@Sales], DESC
        )
    RETURN
        CALCULATE ( [Total Sales], KEEPFILTERS ( Result ) )
)
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 18:39:19 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1541490#M30365</guid>
      <dc:creator>AntrikshSharma</dc:creator>
      <dc:date>2020-12-09T18:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to make RANKX work for columns/different categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1544098#M30473</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="236628" data-lia-user-login="AntrikshSharma" class="lia-mention lia-mention-user"&gt;AntrikshSharma&lt;/a&gt;&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92178" data-lia-user-login="AlB" class="lia-mention lia-mention-user"&gt;AlB&lt;/a&gt;&amp;nbsp;Thank you both very much!&lt;BR /&gt;I tried your Top 3 formula but it was still showing me wrong result when "Color" was not in the visual.&lt;BR /&gt;I managed to get it working by adding a new table&lt;/P&gt;&lt;PRE&gt;Slicer_CustGroups = DISTINCT(VALUES('AA_Master Data'[CMN]))&lt;/PRE&gt;&lt;P&gt;and a new ranking column.&lt;/P&gt;&lt;PRE&gt;Customer Grp = &lt;BR /&gt;VAR topx = RANKX(ALL(Slicer_CustGroups[CMN]),CALCULATE(SUM('AA_Master Data'[Sales+RoFoACT]),ALL('AA_Master Data'[CMN])),,DESC)&lt;BR /&gt;RETURN&lt;BR /&gt;SWITCH(TRUE(),topx&amp;lt;=3,"1) Top 3 Customers",topx&amp;lt;=10,"2) 4.-10. Cust.",topx&amp;lt;=20,"3) 11.-20. Cust.",topx&amp;lt;=50,"4) 21.-50. Cust.",topx&amp;lt;=100,"5) 51.-100. Cust.","6) Remaining Cust.")&lt;/PRE&gt;&lt;P&gt;I know it is not the cleanest solution but it works which is the main thing to me and I can also use it as a slicer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2020 01:02:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1544098#M30473</guid>
      <dc:creator>Tomfiki</dc:creator>
      <dc:date>2020-12-11T01:02:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to make RANKX work for columns/different categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1544917#M30494</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="271432" data-lia-user-login="Tomfiki" class="lia-mention lia-mention-user"&gt;Tomfiki&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Great. I'm still&amp;nbsp;curious as to why the previous solution didn't work. Essentially you're doing the same withing the RANKX. Probably&amp;nbsp;something that is not showing in the examples provided.&lt;/P&gt;
&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="236628" data-lia-user-login="AntrikshSharma" class="lia-mention lia-mention-user"&gt;AntrikshSharma&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe you can get the exact same results with simpler measures:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Top 3 V2 = 
IF( RANKX(ALL(Products[Color]), CALCULATE([Total Sales], ALL(Products[Brand]))) &amp;lt;=3, [Total Sales])&lt;/LI-CODE&gt;&lt;LI-CODE lang="markup"&gt;Top 3 2 V2 = 
IF( RANKX(ALL(Products[Color]), [Total Sales]) &amp;lt;=3, [Total Sales])&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2020 08:39:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1544917#M30494</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-12-11T08:39:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to make RANKX work for columns/different categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1545076#M30500</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92178" data-lia-user-login="AlB" class="lia-mention lia-mention-user"&gt;AlB&lt;/a&gt;&amp;nbsp;Measure Top 3 is optimized, most of the work is done in the Storage engine and only 3 queries are executed.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Quries generated by the measure you have suggested:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Measure 2 -&amp;nbsp; agreed is complex in the looks, but I was trying to get the column total as well.&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2020 09:41:28 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1545076#M30500</guid>
      <dc:creator>AntrikshSharma</dc:creator>
      <dc:date>2020-12-11T09:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to make RANKX work for columns/different categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1545301#M30506</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="236628" data-lia-user-login="AntrikshSharma" class="lia-mention lia-mention-user"&gt;AntrikshSharma&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Measure Top 3&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;I see your point but I'm not that sure. I've just run a couple of tests and, strangely enough, I get for both your and my version readings with a higher use of the SE and, seconds later,&amp;nbsp; readings with the complete opposite, a higher use of the FE. I'm dumbfounded by that; the results are not consistent &lt;span class="lia-unicode-emoji" title=":thinking_face:"&gt;🤔&lt;/span&gt;. I ran the tests on the query for the visual you can get from the Performance analyzer. From what you show, for this case my version seems to be faster. Although I get similar timing&amp;nbsp;performance for both versions in my tests&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Measure Top 3 2 &lt;/U&gt;&lt;/P&gt;
&lt;P&gt;If it's the totals you're missing the measure can be modified&amp;nbsp;slightly without additional complexity or impact on&amp;nbsp; performance:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Top 3 2 V2B =
VAR totalSales_ = [Total Sales]
RETURN
    IF (
        ISFILTERED ( Products[Brand] ),
        IF ( RANKX ( ALL ( Products[Color] ), [Total Sales] ) &amp;lt;= 3, totalSales_ ),
        totalSales_
    )&lt;/LI-CODE&gt;
&lt;P&gt;&lt;STRONG&gt;Please mark the question solved when done and consider &lt;FONT color="#FF9900"&gt;giving a thumbs up if posts are helpful.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;Contact me privately for support with any larger-scale BI needs, tutoring, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Cheers&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2020 11:04:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1545301#M30506</guid>
      <dc:creator>AlB</dc:creator>
      <dc:date>2020-12-11T11:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to make RANKX work for columns/different categories</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1545458#M30509</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="92178" data-lia-user-login="AlB" class="lia-mention lia-mention-user"&gt;AlB&lt;/a&gt;&amp;nbsp;Not sure how you are doing it, for me it is still the same. Also, all three measures you suggested do not add correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Top 3 V2&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Top 3 2 V2B:&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;Top 3 2 V2&lt;/P&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Dec 2020 11:55:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/How-to-make-RANKX-work-for-columns-different-categories/m-p/1545458#M30509</guid>
      <dc:creator>AntrikshSharma</dc:creator>
      <dc:date>2020-12-11T11:55:45Z</dc:date>
    </item>
  </channel>
</rss>

