Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Bourne_Xian
Regular Visitor

Ranking value changed when filtering only one value

Hi, I'm asking anything will cause the rank value changed when filtering only one value?
Thank you for your help!

With DAX:
Sample_Rank = RANKX(ALL(table[category]),[measure],,DESC,DENSE)


E.g. original ranking for category A is 5, once filter slicer selected one category A, then the ranking changed to 6.

If select more than two category, A & B, then ranking show correct value 5.


Also check the following posts which with same issue, no answer provided:
https://community.fabric.microsoft.com/t5/Desktop/Ranking-problem-when-filtering-only-one-value/td-p...

RANKX value changes for filtered value when it sho... - Microsoft Fabric Community
Ranking changes when applying filters - Microsoft Fabric Community

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi All,
Firstly  ryan_mayu and  techies  thank you for yours solutions!
And @Bourne_Xian ,According to your question, after a long time verification, we found that it is because of the date filter's effect on the category A that it can't display the correct value properly, so based on this, we just need to create a new calculation table to make sure that our category A won't receive the effect of the date filter, then we can display the value we want to need.

 

Measure = 
 VAR rankedCategories =
    SUMMARIZE (
        ALLSELECTED ( data[Category A] ),
        [Category A],
        "Test", [Rank Category A by Measure 1]
    )
RETURN
    SUMX ( FILTER ( rankedCategories, [Category A] IN VALUES ( 'Table'[Value] ) ), [Test] )
Rank Category A by Measure 1 = 
IF(
    HASONEVALUE(data[Category A]),
    RANKX(
        ALLSELECTED(data[Category A]),
        calculate(SUM(data[ Measure 1 ]))
    )
)
Table = SUMMARIZE(data,[Category A])

 

 

vxingshenmsft_0-1739934108036.png

If you have further questions you can check out my pbix file, I hope this helps and I would be honored if I could solve your problem!

Hope it helps!

Best regards,
Community Support Team_ Tom Shen

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

7 REPLIES 7
techies
Solution Sage
Solution Sage

Hi @Bourne_Xian please check this , 

 

Category Rank =
IF(
    HASONEVALUE(productcategory[Categories]),
    CALCULATE(
        RANKX(
            ALL(productcategory[Categories]),
            [sales amount vale],
            ,
            DESC
        ),
        VALUES(productcategory[Categories]) 
    ),
    BLANK()  
)
 
 
― Power BI | Microsoft Fabric | PL-300 | DP-600 | Blog: medium.com/@cseprs_54978

Thanks, getting same issue after applied.

Anonymous
Not applicable

Hi All,
Firstly  ryan_mayu and  techies  thank you for yours solutions!
And @Bourne_Xian ,According to your question, after a long time verification, we found that it is because of the date filter's effect on the category A that it can't display the correct value properly, so based on this, we just need to create a new calculation table to make sure that our category A won't receive the effect of the date filter, then we can display the value we want to need.

 

Measure = 
 VAR rankedCategories =
    SUMMARIZE (
        ALLSELECTED ( data[Category A] ),
        [Category A],
        "Test", [Rank Category A by Measure 1]
    )
RETURN
    SUMX ( FILTER ( rankedCategories, [Category A] IN VALUES ( 'Table'[Value] ) ), [Test] )
Rank Category A by Measure 1 = 
IF(
    HASONEVALUE(data[Category A]),
    RANKX(
        ALLSELECTED(data[Category A]),
        calculate(SUM(data[ Measure 1 ]))
    )
)
Table = SUMMARIZE(data,[Category A])

 

 

vxingshenmsft_0-1739934108036.png

If you have further questions you can check out my pbix file, I hope this helps and I would be honored if I could solve your problem!

Hope it helps!

Best regards,
Community Support Team_ Tom Shen

If this post helps then please consider Accept it as the solution to help the other members find it more quickly.

 

 

Hi @Anonymous ,
Thanks for the investigation & provide root cause to us.

Seems this solution only works for one slicer, and without table relationship.
When I bring it into real project, I have multiple slicers on UI that may apply at the same time, slicer fields may in different tables with relationship. The use of filter propagation break this solution.

We may consider create a support ticket. Again, thanks for your help.

Thank you for your kindly help. Provided solution looks good 👍

ryan_mayu
Super User
Super User

could you pls provide some sample data and expected output?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Hi Ryan,

Thanks for your time.
You could find the sample data provided in another post which have extractly same issue: https://www.dropbox.com/s/fhbpj7pgragr2g6/Ranking%20test.pbix?dl=0


Expected output for 27_Cat is 25, while actual output is 8.
Bourne_Xian_0-1739786228173.png

The expected output for 6_Cat is 6, while actual output is 5.

Bourne_Xian_1-1739786395811.png

 

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.