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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

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 FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors