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
Power_MN
Helper I
Helper I

Rank Measure according to categories

Hello everybody, I am faced with a problem with which I cannot make any progress, because I have not found a solution after many researches. So I hope that one of you can help me with this. Rank = RANKX(Table1,Table1[Quality],,DESC,Dense) -> this function doesn't work for me I have a dataset (see table). This should be ranked according to supplier and product. After that, I should be able to have a ranking for each product, showing which supplier is the best and which is the worst. Supplier Product Quality Rank A chair 80% 2 A desk 90% 1 B bed 100% 1 C chair 75% 3 B desk 40% 3 A bed 40% 3 C desk 85% 2 B chair 100% 1 C bed 65% 2 Thank you for your help!
6 REPLIES 6
amitchandak
Super User
Super User

@Power_MN , this is a column rank

Try measure rank

Rank = RANKX(allselected(Table1[product]) ,calculate(Sum(Table1[Quality])),,DESC,Dense)

 

For Rank Refer these links
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns

or my video -https://www.youtube.com/watch?v=DZb_6j6WuZ0

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

@amitchandak Many thanks for your response. Unfortunately the DAX function does not work. It gives me rank 1 for every row. Kind regards Michael

@Power_MN , measure rank is context-sensitive. if you add any other than product like product id, it will become 1. 

 

Geography Rank = RANKX(all(Geography[City]),[Sales])
Geography Rank = RANKX(all(Geography),[Sales])
City and ID Rank = RANKX(all(Geography[City],Geography[City Id]),[Sales])

 

In these examples with city id , first one will give rank  1 only.

 

Try to give table name to combination of columns 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hello @amitchandak,


have you got an advice, how I can do it right? 

Thanks a lot!

315500E3-88F6-4709-84C4-22A3FBA34EAE.jpeg

@amitchandak the content on your link was very helpful. The solution was: Rank = Rankx(Filter(Table,Table1[Product]=EARLIER(Table1[Product])),Table1[Quality],,DESC,Dense) I want to complete this Dax-function with a second category "Product Group". So the ranking has the be grouped by "Product" AND "Product Group". How can i complete a second "Filter" to the ranking DAX-function? Thank you so much! Kind regards

@Power_MN , this is column rank. I suggested measure.

 

Try like this

rankx(filter(table, [supplier] =earlier([supplier] )), [quality],,desc, dense)

 

Also, refer to link I shared 

https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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!

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.