Forum Discussion
RANKX - Unable to RANK Rows For Each Category
- 3 years ago
Hi , WinterMist
Thanks for your sample data and end result first!
According to your description, you want to rank by the [Unique ID] group by the [City].Here are the steps you can refer to :
(1)If you want to create a calculated column in the table , you can use this dax:Column = RANKX( FILTER('Table','Table'[City] = EARLIER('Table'[City])) , 'Table'[Unique ID] ,,ASC ,Dense)(2)If you want to create a measure , you can use this dax:
Measure = RANKX(CALCULATETABLE( VALUES('Table'[Unique ID]), ALLEXCEPT('Table','Table'[City])) , CALCULATE( SUM('Table'[Unique ID]),ALLEXCEPT('Table','Table'[Unique ID])) ,,ASC,Dense)Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi , WinterMist
Thanks for your sample data and end result first!
According to your description, you want to rank by the [Unique ID] group by the [City].
Here are the steps you can refer to :
(1)If you want to create a calculated column in the table , you can use this dax:
(2)If you want to create a measure , you can use this dax:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly