<?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 RANKX wrong grand total in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANKX-wrong-grand-total/m-p/4011781#M157968</link>
    <description>&lt;P&gt;Hello PBI-experts,&lt;/P&gt;&lt;P&gt;I cannot seem to fix the issue. Following constellation results in a wrong grand total in my matrix:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I have a ranking based on different dimensions (dynamic x-axis) as:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;Ranking Dimensions = SWITCH(SELECTEDVALUE('X-Axis'[Dimension],BLANK()), "A",RANKX(ALLSELECTED('DIM_A'[Name]),[Switch KPI],,DESC,DENSE), 
"B",RANKX(ALLSELECTED('DIM_B'[Name]),[Switch KPI],,DESC,DENSE), 
"C",RANKX(ALLSELECTED('DIM_C'[Name]),[Switch KPI],,DESC,DENSE) )&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;And the measure in the matrix as:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;Dynamic Ranking = SUMX(VALUES('X-Axis'[X-Axis]),
IF([Ranking Dimensions]&amp;lt;='X-Axis Ranking TopN'[X-Axis Ranking TopN Value], [Switch KPI]))&lt;/PRE&gt;&lt;P&gt;The slicer works as expected and throws the top N rows, however in the grand total row it misses the context of the TopN slicer and sums up everything.&lt;/P&gt;&lt;P&gt;Any suggestions what I could do?&lt;/P&gt;&lt;P&gt;Thanks alot!&lt;/P&gt;</description>
    <pubDate>Wed, 26 Jun 2024 17:16:04 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-06-26T17:16:04Z</dc:date>
    <item>
      <title>RANKX wrong grand total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANKX-wrong-grand-total/m-p/4011781#M157968</link>
      <description>&lt;P&gt;Hello PBI-experts,&lt;/P&gt;&lt;P&gt;I cannot seem to fix the issue. Following constellation results in a wrong grand total in my matrix:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I have a ranking based on different dimensions (dynamic x-axis) as:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;Ranking Dimensions = SWITCH(SELECTEDVALUE('X-Axis'[Dimension],BLANK()), "A",RANKX(ALLSELECTED('DIM_A'[Name]),[Switch KPI],,DESC,DENSE), 
"B",RANKX(ALLSELECTED('DIM_B'[Name]),[Switch KPI],,DESC,DENSE), 
"C",RANKX(ALLSELECTED('DIM_C'[Name]),[Switch KPI],,DESC,DENSE) )&lt;/PRE&gt;&lt;P&gt;&lt;STRONG&gt;And the measure in the matrix as:&lt;/STRONG&gt;&lt;/P&gt;&lt;PRE&gt;Dynamic Ranking = SUMX(VALUES('X-Axis'[X-Axis]),
IF([Ranking Dimensions]&amp;lt;='X-Axis Ranking TopN'[X-Axis Ranking TopN Value], [Switch KPI]))&lt;/PRE&gt;&lt;P&gt;The slicer works as expected and throws the top N rows, however in the grand total row it misses the context of the TopN slicer and sums up everything.&lt;/P&gt;&lt;P&gt;Any suggestions what I could do?&lt;/P&gt;&lt;P&gt;Thanks alot!&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jun 2024 17:16:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANKX-wrong-grand-total/m-p/4011781#M157968</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-26T17:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: RANKX wrong grand total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANKX-wrong-grand-total/m-p/4012473#M158011</link>
      <description>&lt;P&gt;This may solve it&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Dynamic Ranking = 
VAR SelectedAxis = SELECTEDVALUE('X-Axis'[X-Axis])
RETURN
SUMX(VALUES('X-Axis'[X-Axis]),
    IF (
        NOT ISFILTERED('X-Axis'[X-Axis]) || 'X-Axis'[X-Axis] = SelectedAxis,
        IF (
            [Ranking Dimensions] &amp;lt;= 'X-Axis Ranking TopN'[X-Axis Ranking TopN Value],
            [Switch KPI],
            BLANK()
        ),
        BLANK()
    )
)&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 27 Jun 2024 03:36:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANKX-wrong-grand-total/m-p/4012473#M158011</guid>
      <dc:creator>aduguid</dc:creator>
      <dc:date>2024-06-27T03:36:45Z</dc:date>
    </item>
    <item>
      <title>Re: RANKX wrong grand total</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANKX-wrong-grand-total/m-p/4014047#M158110</link>
      <description>&lt;P&gt;If someone comes across the same issue I´ve figured it out by creating another measure and using it in the filter pane:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;TopN Filter =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;var&lt;/SPAN&gt; &lt;SPAN&gt;selectednumber&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;SELECTEDVALUE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;'X-Axis Ranking TopN'&lt;/SPAN&gt;&lt;SPAN&gt;[X-Axis Ranking TopN]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;RETURN&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;INT&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;[Ranking Dimensions]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;lt;= &lt;/SPAN&gt;&lt;SPAN&gt;selectednumber&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 27 Jun 2024 18:11:49 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/RANKX-wrong-grand-total/m-p/4014047#M158110</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-06-27T18:11:49Z</dc:date>
    </item>
  </channel>
</rss>

