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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Nicolas__
Frequent Visitor

RANKX in a measure

Hi guys, 

 

After hours of searching and trying, I decided to come for your help.

 

I would like to rank my data depending on the filters I've put (series in rows, countries in column, rank in value) - filters are on countries and series: 

SeriesCountry ACountry B
A12
B12
C21
D21

 

If I add a country to my filters, then the ranking needs to be updated. Same for the serie.

SeriesCountry ACountry BCountry C
A123
B132
C321
D231

 

The data behind look like this: 

SeriesCountryValue
ACountry A10
ACountry B5
ACountry C0
BCountry A10
BCountry B0
BCountry C2
CCountry A0
CCountry B20
CCountry C30
DCountry A20
DCountry B5
DCountry C30

 

Any hint please?

I've tried RANKX with measures, etc., but can't crack this so far.

 

Thank you, 

Nicolas

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @Nicolas__ 

I would recommend using the RANK function.

I have attached a sample PBIX with these measures as an example:

Value Sum = 
SUM ( Data[Value] )
Rank by Country = 
RANK (
    DENSE,
    ALLSELECTED ( Data[Country] ),
    ORDERBY ( [Value Sum], DESC BLANKS LAST )
)

OwenAuger_0-1698309857607.png

 

There may be some adjustments needed depending on details of your model, but I would recommend a measure similar to Rank by Country above.

 

Does this work for you?

 

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

2 REPLIES 2
Nicolas__
Frequent Visitor

A big big thank you @OwenAuger , it's working

Now I need to understand why I didn't find it on my own and analyze how it works 🙂

OwenAuger
Super User
Super User

Hi @Nicolas__ 

I would recommend using the RANK function.

I have attached a sample PBIX with these measures as an example:

Value Sum = 
SUM ( Data[Value] )
Rank by Country = 
RANK (
    DENSE,
    ALLSELECTED ( Data[Country] ),
    ORDERBY ( [Value Sum], DESC BLANKS LAST )
)

OwenAuger_0-1698309857607.png

 

There may be some adjustments needed depending on details of your model, but I would recommend a measure similar to Rank by Country above.

 

Does this work for you?

 

Regards


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.