Ranking columns and measures can prove challenging when first learning DAX. It is easy to arrive at seemingly nonsensical ranks or ranks that are all 1. This recipe demonstrates how to properly use DAX's RANKX function to rank items when dealing with calculated columns as well as measures.
Ranking columns and measures
Getting ready
To prepare for this recipe, perform the following steps:
- Open Power BI Desktop.
- Use an Enter Data query to create a table called R04_Table with the following data:
Item |
Category1 |
Category2 |
Value |
Item 1 |
Green |
Blue |
100 |
Item 2 |
Blue |
Green |
200 |
Item 3 |
Green |
Blue |
300 |
Item 4 |
Blue |
Green |
400 |
Item 5 |
Red |
Blue |
500 |
Item 6 |
Red |
Green |
600... |