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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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