<?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: Rank changes as soon as I apply visual level filter to filter out TopN in DAX Commands and Tips</title>
    <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4328088#M171817</link>
    <description>&lt;DIV class=""&gt;
&lt;DIV&gt;
&lt;DIV class=""&gt;
&lt;DIV class=""&gt;
&lt;DIV class=""&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="894417" data-lia-user-login="Anuj_Nnada" class="lia-mention lia-mention-user"&gt;Anuj_Nnada&lt;/a&gt;,&lt;/DIV&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class=""&gt;Some DAX queries, particularly those using the RANKX function, may have limitations as it dynamically adjusts to filters applied, including visual-level filters. This behavior can result in unexpected changes to rank values.&lt;/DIV&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class=""&gt;For reference :&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/dax/rank-function-dax" target="_blank" rel="noopener"&gt;RANK function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class=""&gt;Please let me know if you have any other queries.&lt;/DIV&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class=""&gt;Regards,&lt;/DIV&gt;
&lt;DIV class=""&gt;Vinay Pabbu&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
    <pubDate>Fri, 13 Dec 2024 14:03:24 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2024-12-13T14:03:24Z</dc:date>
    <item>
      <title>Rank changes as soon as I apply visual level filter to filter out TopN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4318735#M171459</link>
      <description>&lt;P&gt;Hi, I have Ranking measure which is working fine and giving me the correct ranking based on different column in my Table&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Rank =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;IF&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;HASONEVALUE&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;Dim_Professionals&lt;/SPAN&gt;&lt;SPAN&gt;[ProfessionalKey]&lt;/SPAN&gt;&lt;SPAN&gt; ) &amp;amp;&amp;amp; &lt;/SPAN&gt;&lt;SPAN&gt;[Sales]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;gt; &lt;/SPAN&gt;&lt;SPAN&gt;0&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;RANKX&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;ALLSELECTED&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;Dim_Professionals&lt;/SPAN&gt;&lt;SPAN&gt; ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;[Sales]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;ALLSELECTED&lt;/SPAN&gt;&lt;SPAN&gt;( &lt;/SPAN&gt;&lt;SPAN&gt;Dim_Territory[Territory]&lt;/SPAN&gt;&lt;SPAN&gt;),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;ALLSELECTED&lt;/SPAN&gt;&lt;SPAN&gt;( Dim_Segments&lt;/SPAN&gt;&lt;SPAN&gt;[Segment]&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ),&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;DESC&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;DENSE&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; )&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;Problem is now I want to filter out my table absed on Top10 or Top20 Selection as soon as I use the below dax in the visual level filter and select "1", my Rank measure start giving me different result. How can I solve this problem and not make it change the result while using a visual level filter?&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;VAR&lt;/SPAN&gt; &lt;SPAN&gt;TopNN&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;RankFilter&lt;/SPAN&gt;&lt;SPAN&gt;[Top Value]&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;IF&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;HASONEVALUE&lt;/SPAN&gt;&lt;SPAN&gt; ( &lt;/SPAN&gt;&lt;SPAN&gt;Dim_Professionals&lt;/SPAN&gt;&lt;SPAN&gt;[ProfessionalKey]&lt;/SPAN&gt;&lt;SPAN&gt; ) &amp;amp;&amp;amp; &lt;/SPAN&gt;&lt;SPAN&gt;[Sales]&lt;/SPAN&gt;&lt;SPAN&gt; &amp;gt; &lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt; &amp;amp;&amp;amp; &lt;/SPAN&gt;&lt;SPAN&gt;[Rank]&lt;/SPAN&gt;&lt;SPAN&gt;&amp;lt;=&lt;/SPAN&gt;&lt;SPAN&gt;TopNN&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;BLANK&lt;/SPAN&gt;&lt;SPAN&gt;())&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 09 Dec 2024 00:01:22 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4318735#M171459</guid>
      <dc:creator>Anuj_Nnada</dc:creator>
      <dc:date>2024-12-09T00:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: Rank changes as soon as I apply visual level filter to filter out TopN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4318762#M171462</link>
      <description>&lt;P&gt;Just realised, it is filtering the table correctly as per sales but visually changing the ranking. Which is super weird!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 01:04:14 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4318762#M171462</guid>
      <dc:creator>Anuj_Nnada</dc:creator>
      <dc:date>2024-12-09T01:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: Rank changes as soon as I apply visual level filter to filter out TopN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4318924#M171466</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="894417" data-lia-user-login="Anuj_Nnada" class="lia-mention lia-mention-user"&gt;Anuj_Nnada&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ALLSELECTED function will observe visual level filters, since you applied TOPN visual level filter which is an external filter, it will apply that filter and recalculate rank value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;lets say you added "[RankMeasure] &amp;nbsp;greater than 10" visual filter then it will remove topn 10 professional key and then calculates then rank, so you rank measure values in the visual will start from 1.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would suggest you to first remove the visual filter and add the Filter measure that you created to apply the visual level filter into the visual and see if there any issues.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you need any further help then please share the PBIX file with sample data and expected result.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Need a Power BI Consultation? Hire me on &lt;A href="https://bit.ly/4d3oy4s" target="_blank" rel="noopener"&gt;Upwork&lt;/A&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;
&lt;P&gt;Connect on &lt;A href="https://www.linkedin.com/in/tharun-kumar-ravikrindhi/" target="_blank" rel="noopener"&gt;LinkedIn&lt;/A&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;
&lt;DIV class=""&gt;&lt;BR /&gt;&lt;BR /&gt;
&lt;DIV class=""&gt;&lt;BR /&gt;&lt;BR /&gt;
&lt;DIV style="border-radius: 1px; padding: 10px; border: solid #cccccc 1px; background: #fafafa no-repeat right 10px center;"&gt;&lt;BR /&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;BR /&gt;&lt;BR /&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;STRONG style="margin-right: 3px;"&gt;&lt;STRONG style="margin-right: 3px;"&gt;Did I answer your question? Mark my post as a solution!&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;STRONG style="margin-right: 3px;"&gt;&lt;STRONG style="margin-right: 3px;"&gt;If I helped you, click on the Thumbs Up to give Kudos.&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;BR /&gt;
&lt;P style="padding: 0; margin: 5px 50px 0 0;"&gt;Proud to be a Super User!&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 09 Dec 2024 03:27:32 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4318924#M171466</guid>
      <dc:creator>tharunkumarRTK</dc:creator>
      <dc:date>2024-12-09T03:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Rank changes as soon as I apply visual level filter to filter out TopN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4318928#M171467</link>
      <description>&lt;P&gt;I understand what you're trying to say but how can I make my Rank not get affected by the visual level filter? I am already using the filter measure and using it in Visual level filter and only filtering those records that which have rank &amp;lt;=10. Is there any way we can make sure that Rank measure ignore the visual level filter?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 03:45:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4318928#M171467</guid>
      <dc:creator>Anuj_Nnada</dc:creator>
      <dc:date>2024-12-09T03:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: Rank changes as soon as I apply visual level filter to filter out TopN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4319702#M171484</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="894417" data-lia-user-login="Anuj_Nnada" class="lia-mention lia-mention-user"&gt;Anuj_Nnada&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Ideally if you are just filterin topn then it shoud not effect your rank numbers. for example if you see the below image&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Rank 
RankFunction = RANKX(ALLSELECTED( Customers[CompanyName] , Customers[CustomerID]), [Revenue], ,DESC,Dense) 
-------------------
Visual filter 

RankFunction2 = 
var maxValue = max(topntable[value])
return if([rankfunction] &amp;lt;= maxvalue,1,0) 


&lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However if you filter out topn then it will cause the problem&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;RankFunction2 = 
var maxValue = max(topntable[value])
return if([rankfunction] &amp;gt;= maxvalue,1,0) &lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;P&gt;If filtering topn is only the requirement then you can use this pattern&amp;nbsp;&lt;/P&gt;
&lt;P&gt; &lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;TopnFunction = 
Var __N = MAX(topntable[Value])
Var __TopnTable = TOPN(__N, ALLSELECTED(Customers[CompanyName], Customers[CustomerID]), [Revenue], DESC)
Var __Result = CALCULATE([Revenue], KEEPFILTERS(__TopnTable))
RETURN __Result &lt;/LI-CODE&gt;
&lt;P&gt;&lt;img /&gt;&lt;/P&gt;
&lt;P&gt;For further assistance please share your PBIX file with sample data and expected result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Need a Power BI Consultation? Hire me on &lt;A href="https://bit.ly/4d3oy4s" target="_blank" rel="noopener"&gt;Upwork&lt;/A&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;
&lt;P&gt;Connect on &lt;A href="https://www.linkedin.com/in/tharun-kumar-ravikrindhi/" target="_blank" rel="noopener"&gt;LinkedIn&lt;/A&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;
&lt;DIV class=""&gt;&lt;BR /&gt;&lt;BR /&gt;
&lt;DIV class=""&gt;&lt;BR /&gt;&lt;BR /&gt;
&lt;DIV style="border-radius: 1px; padding: 10px; border: solid #cccccc 1px; background: #fafafa no-repeat right 10px center;"&gt;&lt;BR /&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;BR /&gt;&lt;BR /&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;STRONG style="margin-right: 3px;"&gt;&lt;STRONG style="margin-right: 3px;"&gt;Did I answer your question? Mark my post as a solution!&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;STRONG style="margin-right: 3px;"&gt;&lt;STRONG style="margin-right: 3px;"&gt;If I helped you, click on the Thumbs Up to give Kudos.&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;BR /&gt;
&lt;P style="padding: 0; margin: 5px 50px 0 0;"&gt;Proud to be a Super User!&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Mon, 09 Dec 2024 13:02:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4319702#M171484</guid>
      <dc:creator>tharunkumarRTK</dc:creator>
      <dc:date>2024-12-09T13:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: Rank changes as soon as I apply visual level filter to filter out TopN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4319814#M171492</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="894417" data-lia-user-login="Anuj_Nnada" class="lia-mention lia-mention-user"&gt;Anuj_Nnada&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for using the Microsoft Fabric Community!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The rank is dynamically recalculated whenever the context changes (e.g., after applying the filter to show only TopN rows). The ranks are recalculated within the filtered context, which leads to the rankings being different than expected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to ensure that the rank is calculated over the entire dataset and not affected by the filter applied to the visual. The ranking should be computed as if there were no filters at all on the dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remove the visual filter's effect from the ranking measure by using ALL in the RANKX function, which ignores the applied filters and ranks over all available data.&lt;/P&gt;
&lt;P&gt;Apply the filter only to display the top N rows based on the calculated rank.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this steps works please accept this as solution. If you need a more detailed explanation, kindly share the PBIX file along with sample data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards&lt;/P&gt;
&lt;P&gt;Vinay Pabbu&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 14:03:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4319814#M171492</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-09T14:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: Rank changes as soon as I apply visual level filter to filter out TopN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4319978#M171499</link>
      <description>&lt;P&gt;I agree! Even I think of filtering the Dataset first using TOPN Dax function. However, the problem with TOPN is that it is not considering ties and is giving me random no. of rows. Please find attached the screenshot below!&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;When I filter Top 10 - It gives me 10 Rows&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;when I filter Top 20 - It gives me 34 rows&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Measure Used -&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;TopN =&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;CALCULATE&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;[Sales]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;KEEPFILTERS&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;TOPN&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;2&lt;/SPAN&gt;&lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;ALLSELECTED&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;Dim_Customer&lt;/SPAN&gt;&lt;SPAN&gt;), [Sales]&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;DESC&lt;/SPAN&gt;&lt;SPAN&gt;)))&lt;BR /&gt;&lt;BR /&gt;Why does it give some random number of rows?&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 15:46:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4319978#M171499</guid>
      <dc:creator>Anuj_Nnada</dc:creator>
      <dc:date>2024-12-09T15:46:44Z</dc:date>
    </item>
    <item>
      <title>Re: Rank changes as soon as I apply visual level filter to filter out TopN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4320029#M171504</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="894417" data-lia-user-login="Anuj_Nnada" class="lia-mention lia-mention-user"&gt;Anuj_Nnada&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fix the Ranking Measure:&lt;/P&gt;&lt;PRE&gt;Rank =&lt;BR /&gt;IF (&lt;BR /&gt;HASONEVALUE ( Dim_Professionals[ProfessionalKey] ) &amp;amp;&amp;amp; [Sales] &amp;gt; 0,&lt;BR /&gt;RANKX (&lt;BR /&gt;ALLSELECTED ( Dim_Professionals ),&lt;BR /&gt;CALCULATE (&lt;BR /&gt;[Sales],&lt;BR /&gt;ALLSELECTED( Dim_Territory[Territory] ),&lt;BR /&gt;ALLSELECTED( Dim_Segments[Segment] )&lt;BR /&gt;),&lt;BR /&gt;,&lt;BR /&gt;DESC,&lt;BR /&gt;DENSE&lt;BR /&gt;)&lt;BR /&gt;)&lt;/PRE&gt;&lt;P&gt;Top N Filter Measure:&lt;/P&gt;&lt;PRE&gt;TopNFilter =&lt;BR /&gt;VAR TopNN = SELECTEDVALUE ( RankFilter[Top Value], 10 ) // Default Top Value&lt;BR /&gt;RETURN&lt;BR /&gt;IF ( &lt;BR /&gt;HASONEVALUE ( Dim_Professionals[ProfessionalKey] ) &amp;amp;&amp;amp; [Rank] &amp;lt;= TopNN, &lt;BR /&gt;1, &lt;BR /&gt;BLANK() &lt;BR /&gt;)&lt;/PRE&gt;&lt;P&gt;Use the TopNFilter measure as a visual-level filter on your table and set it to "is not blank." This ensures the visual shows only rows with ranks less than or equal to the selected TopNN value, without affecting the evaluation of the Rank measure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":love_letter:"&gt;💌&lt;/span&gt; If this helped, a Kudos &lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt; or Solution mark &lt;span class="lia-unicode-emoji" title=":white_heavy_check_mark:"&gt;✅&lt;/span&gt; would be great! &lt;span class="lia-unicode-emoji" title=":party_popper:"&gt;🎉&lt;/span&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Kedar&lt;BR /&gt;&lt;A href="https://www.linkedin.com/in/kedar-pande" target="_blank" rel="noopener"&gt;Connect on LinkedIn&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 16:14:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4320029#M171504</guid>
      <dc:creator>Kedar_Pande</dc:creator>
      <dc:date>2024-12-09T16:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: Rank changes as soon as I apply visual level filter to filter out TopN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4320047#M171506</link>
      <description>&lt;P&gt;I have already tried this. Problem is that as soon as I pull Territory and Segment in my table it changes the ranking while the visual level filter is set to&lt;SPAN&gt;&amp;nbsp;"is not blank." I hope you undertsand!&lt;BR /&gt;&lt;BR /&gt;When Visual Level fiulter applied -&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;When Visual level filter not applied -&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;img /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Dec 2024 16:26:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4320047#M171506</guid>
      <dc:creator>Anuj_Nnada</dc:creator>
      <dc:date>2024-12-09T16:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: Rank changes as soon as I apply visual level filter to filter out TopN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4320688#M171543</link>
      <description>&lt;P&gt;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="894417" data-lia-user-login="Anuj_Nnada" class="lia-mention lia-mention-user"&gt;Anuj_Nnada&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I dont think it is giving random number of rows. It is filtering all the rows which falls under the rank filter criteria, i.e less than 20.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From what I understand, you need ROWNUMBER function which gives unique rank based on the criteria.&amp;nbsp;&lt;BR /&gt;please go through this&amp;nbsp;&lt;BR /&gt;&lt;A href="https://dax.guide/rownumber/" target="_blank"&gt;https://dax.guide/rownumber/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;After creating the measure, within the measure you can add a condition.&lt;BR /&gt;if (rownumber &amp;lt; tonnfilter, rownumber, blank())&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Need a Power BI Consultation? Hire me on &lt;A href="https://bit.ly/4d3oy4s" target="_blank" rel="noopener"&gt;Upwork&lt;/A&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;
&lt;P&gt;Connect on &lt;A href="https://www.linkedin.com/in/tharun-kumar-ravikrindhi/" target="_blank" rel="noopener"&gt;LinkedIn&lt;/A&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;
&lt;DIV class=""&gt;&lt;BR /&gt;&lt;BR /&gt;
&lt;DIV class=""&gt;&lt;BR /&gt;&lt;BR /&gt;
&lt;DIV style="border-radius: 1px; padding: 10px; border: solid #cccccc 1px; background: #fafafa no-repeat right 10px center;"&gt;&lt;BR /&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;BR /&gt;&lt;BR /&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;STRONG style="margin-right: 3px;"&gt;&lt;STRONG style="margin-right: 3px;"&gt;Did I answer your question? Mark my post as a solution!&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;&lt;STRONG style="margin-right: 3px;"&gt;&lt;STRONG style="margin-right: 3px;"&gt;If I helped you, click on the Thumbs Up to give Kudos.&lt;BR /&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;BR /&gt;
&lt;P style="padding: 0; margin: 5px 50px 0 0;"&gt;Proud to be a Super User!&lt;/P&gt;
&lt;/TD&gt;
&lt;TD&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;img /&gt;&lt;/DIV&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 10 Dec 2024 02:16:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4320688#M171543</guid>
      <dc:creator>tharunkumarRTK</dc:creator>
      <dc:date>2024-12-10T02:16:07Z</dc:date>
    </item>
    <item>
      <title>Re: Rank changes as soon as I apply visual level filter to filter out TopN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4324413#M171689</link>
      <description>&lt;P&gt;I agree with your point but the Rownumber function doesn't consider Ties so in my case it will not help as I have data with ties.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Dec 2024 18:13:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4324413#M171689</guid>
      <dc:creator>Anuj_Nnada</dc:creator>
      <dc:date>2024-12-11T18:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: Rank changes as soon as I apply visual level filter to filter out TopN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4328088#M171817</link>
      <description>&lt;DIV class=""&gt;
&lt;DIV&gt;
&lt;DIV class=""&gt;
&lt;DIV class=""&gt;
&lt;DIV class=""&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="894417" data-lia-user-login="Anuj_Nnada" class="lia-mention lia-mention-user"&gt;Anuj_Nnada&lt;/a&gt;,&lt;/DIV&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class=""&gt;Some DAX queries, particularly those using the RANKX function, may have limitations as it dynamically adjusts to filters applied, including visual-level filters. This behavior can result in unexpected changes to rank values.&lt;/DIV&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class=""&gt;For reference :&amp;nbsp;&lt;A href="https://learn.microsoft.com/en-us/dax/rank-function-dax" target="_blank" rel="noopener"&gt;RANK function (DAX) - DAX | Microsoft Learn&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class=""&gt;Please let me know if you have any other queries.&lt;/DIV&gt;
&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class=""&gt;Regards,&lt;/DIV&gt;
&lt;DIV class=""&gt;Vinay Pabbu&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 13 Dec 2024 14:03:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4328088#M171817</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-13T14:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: Rank changes as soon as I apply visual level filter to filter out TopN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4335042#M172121</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="894417" data-lia-user-login="Anuj_Nnada" class="lia-mention lia-mention-user"&gt;Anuj_Nnada&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?&lt;BR /&gt;If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Vinay Pabbu&lt;/P&gt;</description>
      <pubDate>Wed, 18 Dec 2024 12:17:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4335042#M172121</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-18T12:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: Rank changes as soon as I apply visual level filter to filter out TopN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4338660#M172278</link>
      <description>&lt;P&gt;Hi &lt;a href="javascript:void(0)" data-lia-user-mentions="" data-lia-user-uid="894417" data-lia-user-login="Anuj_Nnada" class="lia-mention lia-mention-user"&gt;Anuj_Nnada&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;May I ask if you have gotten this issue resolved?&lt;/P&gt;
&lt;P&gt;If it is solved, please mark the helpful reply or share your solution and accept it as solution, it will be helpful for other members of the community who have similar problems as yours to solve it faster.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Vinay Pabbu&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2024 12:21:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4338660#M172278</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-20T12:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: Rank changes as soon as I apply visual level filter to filter out TopN</title>
      <link>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4343472#M172459</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;A href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/894417" target="_blank"&gt;@Anuj_Nnada&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As we haven’t heard back from you, we wanted to kindly follow up to check if the solution provided for the issue worked? or Let us know if you need any further assistance?&lt;BR /&gt;If our response addressed, please mark it as Accept as solution and click Yes if you found it helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Vinay Pabbu&lt;/P&gt;</description>
      <pubDate>Thu, 26 Dec 2024 09:25:56 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/DAX-Commands-and-Tips/Rank-changes-as-soon-as-I-apply-visual-level-filter-to-filter/m-p/4343472#M172459</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-12-26T09:25:56Z</dc:date>
    </item>
  </channel>
</rss>

