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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
hamachekm
Helper I
Helper I

Conditional Ranking as Calculated Column or Power Query

I'm trying to add a ranking to a table. In this simple example, I want to rank the cost of each Fruit. This ranking will then be used to pull in a value from another table, so I want to do this either in Power Query or as a Calculated Column. (In Excel, I'd use =SUMPRODUCT((C:C<=C4)*(A:A=A4)) )

 

Thanks - Mike

 

FruitStatePriceFruit Rank
AppleWI1001
AppleTN5004
AppleCA2002
AppleWA3003
PearWI2002
PearCA1001
PearTX4003
1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

@hamachekm , you might want to refer to the following solutions in Power Query and in calculated column,

 

Power Query solution

Screenshot 2021-03-30 232214.png

 

Calculated column solution,

Screenshot 2021-03-30 232250.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

1 REPLY 1
CNENFRNL
Community Champion
Community Champion

@hamachekm , you might want to refer to the following solutions in Power Query and in calculated column,

 

Power Query solution

Screenshot 2021-03-30 232214.png

 

Calculated column solution,

Screenshot 2021-03-30 232250.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors