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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.