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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
wenchi
Helper I
Helper I

Rankx return incorrect value randomly

Hi,

We have a PBI report using SSAS live connection to Azure AS model. I am using the rankx function to rank product brand by current year vol. It's not showing the correct rank number all the time. (see picture below) There are few rows with different vol but rank the same. Sometimes it seems worinking just fine, but not all the time and I can figure it out.

 

Here is the measure,  

brand_rank = if(ISINSCOPE(Dim_Custom_BrandGroup[brand_family_des]),
CALCULATE(RANKX(ALL(Dim_Custom_BrandGroup[brand_family_des]),[Chain CURR Pd Vol],,DESC,Skip),Dim_Custom_BrandGroup[group_type]="brand family"),BLANK())
 
Rank.png 

Really appreciated for all helps.
 
Wenchi
4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

@wenchi Those are indications of ties. Would need to know what [Chain CURR Pd Vol] is.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

The [Chain CURR Pd Vol] is the last column shown in the picture. it definitely shows different volume with the same rank, which is incorrect. I've validate the data against our database and it shows correct volume.

When you calculate the rank, you are CHANGING THE CONTEXT of the calculation: Dim_Custom_BrandGroup[group_type]="brand family". This is why your rank does not tally with what you see in the matrix. In the matrix you don't change the context.

i have the same filter applied to the table visual.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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