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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Caesarul
Helper II
Helper II

RANKX not responding to filters or anything

Hi, 

 

I'm trying to create a leaderboard based on Total Points made by each country. 

 

I used this formula 

_Rank = RANKX( ALL('GSW Active'[Country]), [_Total Points], , DESC)
 
The No. Column is just a bunch of 1's... Any ideas how I can make it work? I've tried for hours... 
 
It did work before, not sure how I messed it up... but I did have one more issue.

I wanted to rank based on a 2nd measure (tried multiple formulas, nothing worked), want to use "Hired/HC" as most of the time the countries have the same number of points so the No. column is repeating ranking because of that:  1, 2, 3, 3, 3, 6, 7, 7, 9 etc.
 
I tried _Rank = RANKX( ALL('GSW Active'[Country]), [_Total Points] * [_Hired/HC], , DESC) but it doesn't apply in this case.
 
All columns are from the same table, structured like this: 
 
Country / Month / Total Points / Hired / HC / "Hired/HC"
 
There is a slicer on the page for the Month (date), not sure if it needs to be added in the measure.  
Caesarul_1-1675863266536.png

 

 
Caesarul_0-1675862823481.png

 

2 ACCEPTED SOLUTIONS
Greg_Deckler
Super User
Super User

@Caesarul Is your formula actually:

_Rank = RANKX( ALL('GSW Active'[Country]), [_Total Points], , DESC)

Note the additional paren ) after [Country]

You may find this theraputic: To *Bleep* with RANKX! - Microsoft Power BI Community



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

Caesarul
Helper II
Helper II

My final form was: 

_Rank = RANKX(ALL('GSW Active'[Country], 'GSW Active'[Flags URL]), [_Total Points] + [_Hired/HC], ,DESC, DENSE)

Not fully happy with it... but... my head is exploding... 

Tomorrow is another day... 

View solution in original post

4 REPLIES 4
Caesarul
Helper II
Helper II

My final form was: 

_Rank = RANKX(ALL('GSW Active'[Country], 'GSW Active'[Flags URL]), [_Total Points] + [_Hired/HC], ,DESC, DENSE)

Not fully happy with it... but... my head is exploding... 

Tomorrow is another day... 
Caesarul
Helper II
Helper II

Thanks @Greg_Deckler 

So I found out that the flags were at fault... changed the measure to include flags as well:

_Rank = RANKX(ALL('GSW Active'[Country], 'GSW Active'[Flags URL]), [_Total Points], ,DESC, DENSE)
 
Can I can do something about those countries that have equal points? I'd like to add the highest _Hired/HC as 2nd priority somehow. 

Caesarul_0-1675874195942.png

 



@Caesarul Well, you can do something about ties using this approach: The Mythical DAX Index - Microsoft Power BI Community



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

@Caesarul Is your formula actually:

_Rank = RANKX( ALL('GSW Active'[Country]), [_Total Points], , DESC)

Note the additional paren ) after [Country]

You may find this theraputic: To *Bleep* with RANKX! - Microsoft Power BI Community



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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