Forum Discussion
Issues with RANKX
- 5 years ago
Hi, Gombosf , you might want to try this measure
Rank = RANKX(ALLSELECTED(Table1[Name]), [Total_value])In fact, the mechanism of RANKX() under the hood is way much trickier than it appears. Here are some links for your further study if you're looking to master this most frequently-used function in DAX and to put it in your quiver.
https://docs.microsoft.com/en-us/dax/rankx-function-dax
https://www.sqlbi.com/articles/use-of-rankx-in-power-bi-measures/
- 5 years ago
Gombosf , Rank is context-sensitive. When you take the table the level of the table where it going to create rank from.
Try a measure like
Ranking_value = RANKX(ALLSelected(Table1[Name]), [Total_value])
refer: https://www.youtube.com/watch?v=DZb_6j6WuZ0
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
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415
Gombosf , Rank is context-sensitive. When you take the table the level of the table where it going to create rank from.
Try a measure like
Ranking_value = RANKX(ALLSelected(Table1[Name]), [Total_value])
refer: https://www.youtube.com/watch?v=DZb_6j6WuZ0
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
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale
https://community.powerbi.com/t5/Community-Blog/Dynamic-TopN-made-easy-with-What-If-Parameter/ba-p/367415
Dear CNENFRNL and amitchandak !
Thank you for your help.
I think the main issue with the RANKX command was that I didn't use a separate table for the command. I feel this reason responsible for the wrong ranking order.
I hope that you can see the picture attached.
If this is the reason for the wrong ranking order, then I don't really understand the behaviour of the RANKX command (I have no clue why is it necessary to create a brand new table for having this ranking in a right way). Maybe this comes simply from the nature of the command. 🙂
Many-many thanks.