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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

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

August Carousel

Fabric Community Update - August 2024

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