Forum Discussion
Auto rank rows durning slicing
Hi!
I have a table where I have three columns ordered by Inhabitants
1. State
2. City
3. Inhabitants
What I need is a column Rank that just starts with 1 and ends with the number of the last column. This column must adjust automatically during slicing. Let us say my slicer is "States" and I click on NewYork. Now I want to see all the citys ordered by inhabitants but I need a column 1..x so I can see the rank of each city.
I hope I could make myself clear enough. Is that possible?
Best
Hi Ruedi007 ,
Please create two measures like this.
Current_Inhabitants = MAX(Sheet1[Inhabitants])_Rank = RANKX( ALLSELECTED(Sheet1), [Current_Inhabitants], , DESC, Dense )Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
3 Replies
- amitchandak
Super User
Ruedi007 ,Can you share sample data and sample output in table format?
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- Ruedi007Frequent Visitor
Hello thank you for your answer. Unfortunately non of the linked solutions cover my problem. I will explain it with shown data that is a good idea.
The data and slicer look like this:
Data and Slicer
The result without selecting a slicer should look like this:
No Selection
If I select one of the options in the slicer the list should change to:
With selection (California)
In this case I selected california.
As you see the Rank column adjusts depending on the Slicer. I want to have this feature in the Report and Dashboard. If anyone has an idea how to accomplish this? That would be very helpful for me.
Best!
- v-lionel-msft
Community Support
Hi Ruedi007 ,
Please create two measures like this.
Current_Inhabitants = MAX(Sheet1[Inhabitants])_Rank = RANKX( ALLSELECTED(Sheet1), [Current_Inhabitants], , DESC, Dense )Best regards,
Lionel ChenIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.