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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
GWoodhouse
New Member

Problems with DAX RankX

I have a table containing Country names and Priority Orders

Country Priority

UK          1

US          1

NL          2

 

and another table containing a measure that sums a value

What I want is

Rank    Priority  Country   SumofValue

1          1            US           1000

2          2            NL            900

3          1            UK            800

 

But what I am getting is the following because it's ranking by country within the Priority groups

Rank    Priority  Country   SumofValue

1          1            US           1000

1          2            NL            900

2          1            UK            800

 

My DAX is al follows

Country Rank =
Rankx(
        all(Country[CountryName]),
        MySumMeasure,
        ,desc
        ,Dense
    )
 
Where am I going wrong?
Thanks in advance
1 ACCEPTED SOLUTION
FreemanZ
Super User
Super User

hi @GWoodhouse 

try like:

Country Rank =
Rankx(
        all(Country[CountryName]),
        CALCULATE[MySumMeasure], ALL(Country[Priority]),
        ,desc
        ,Dense
    )

View solution in original post

3 REPLIES 3
FreemanZ
Super User
Super User

hi @GWoodhouse 

try like:

Country Rank =
Rankx(
        all(Country[CountryName]),
        CALCULATE[MySumMeasure], ALL(Country[Priority]),
        ,desc
        ,Dense
    )

PERFECT!

Now please explain why that works 😉

[MySumMeasure], as a measure, has an implicit CALCULATE, which converts the row context - Priority, to filter context. 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.