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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Rankx not working correctly

Hello everyone, 

 

I have a simple RankX function, but it's not working as expected. I want to rank F1 drivers with the most championship titles. 

 

The formula for the titles is: 

Total championships =
CALCULATE(COUNT(Champions[Champion]), ALL('Date'), 'Date'[Date] <= MAX('Date'[Date]))
 
The Rank formula is:
Rank champions =
RANKX(ALL(Champions),[Total championships],,DESC, Dense)
 
The result is this:
Rank champions.jpg
1 ACCEPTED SOLUTION
aadatapro
Frequent Visitor

If you restrict your first parameter of the Rankx function to the column or columns you want to rank by, this should solve your issue e.g.
RANKX(ALL(Champions[Champion]),[Total championships],,DESCDense)

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Thanks! That worked. 

@Ashish_Mathur , thanks for your suggestion. I have an animated dashboard, so that's why I've added the filter context. 

Ashish_Mathur
Super User
Super User

Additionally, you can simplify your first measure to just

Total championships = COUNT(Champions[Champion])
Hope this helps.

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
aadatapro
Frequent Visitor

If you restrict your first parameter of the Rankx function to the column or columns you want to rank by, this should solve your issue e.g.
RANKX(ALL(Champions[Champion]),[Total championships],,DESCDense)

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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