-
1. Re: Ranking within Hierarchy
Sherzodbek Ibragimov Feb 18, 2017 6:31 AM (in response to Mahesh Ruikar)Have you tried to achieve with nested sorting? Here is some info how to get to the result you are looking for: Finding the Top N Within a Category | Tableau Software
Also, in case you don't want to show combined file, you can simple bring each dimension and hide combined field.
-
2. Re: Ranking within Hierarchy
Sherzodbek Ibragimov Feb 18, 2017 6:32 AM (in response to Mahesh Ruikar)Here is video instruction if above link is too much :-)
-
3. Re: Ranking within Hierarchy
ranjit saha Feb 18, 2017 1:32 PM (in response to Mahesh Ruikar)Hello Mahesh,
What you are looking for is a nested ranking.
Taking the example that you quoted:
Put States as rows and sales as columns - and sort descending - this will give you the rank based on states.
As you mentioned inf you insert cities with it, the rank gets messed up.
In this case all you have to do it take the dimensions, Sates and Cities, and make a combined field.
Now, remove cities that you had before, get the combined field of (States and cities). You will notice the change. and the ranking will be maintained.
Thanks,
Ranjit
-
4. Re: Ranking within Hierarchy
Mahesh Ruikar Feb 19, 2017 12:06 AM (in response to Sherzodbek Ibragimov)Sherzodbek
Thanks for your response. This video is only about first level of ranking which I have achieved but if I click on the expand button on state which shows the cities, the ranking goes away. I do want to be able to maintain the hierarchy but at the same time, when I click on the state pill to expand to cities, I expect the sorting to be maintained which is not happening.
Thanks
- Mahesh
-
5. Re: Ranking within Hierarchy
Mahesh Ruikar Feb 19, 2017 12:06 AM (in response to ranjit saha)Ranjit
Thanks for the reply.
By combining the State and City, it works the way you have explained however, I want to maintain the hierarchy and be able to click on the state blue pill to expand to city and when I do that, it still messes up things.
- Mahesh
-
6. Re: Ranking within Hierarchy
ranjit saha Feb 19, 2017 4:47 AM (in response to Mahesh Ruikar)ok, Try this.
Put the dimension State first in the rows and then get your measure in the columns. Sort by Measure, either ascending or descending.
then put the combined dimension in the rows beside state. you will notice that the city values are sorted within the state, that is already sorted. Try adding the city next to the combined dimension and then hide the combined dimension. you should achieve what you are looking for.
If it doesnt work as you desire, then attach the workbook, let me have look into that.
Thanks,
Ranjit.
-
7. Re: Ranking within Hierarchy
Sherzodbek Ibragimov Feb 19, 2017 2:21 PM (in response to Mahesh Ruikar)Will this meet your expectations as seen below?
All above dimensions have computed sorting based on Sales, descending.
-
sorting.twbx 1.5 MB
-
-
8. Re: Ranking within Hierarchy
Mahesh Ruikar Feb 19, 2017 10:00 PM (in response to Sherzodbek Ibragimov)Sherzodbek
The picture looks what I am looking for but my fear is that if I click on the hierarchy pills, this is going to mess up. But sure it does look like what I need.
Do you have the steps I can use to achieve this?
Thanks
- Mahesh
-
9. Re: Ranking within Hierarchy
Mahesh Ruikar Feb 19, 2017 10:00 PM (in response to ranjit saha)Ranjit
It works the way you have described but the moment I click on State pill, it collapses City under it and when I expand, the sorting gets messed up. I have attached the workbook in my original post. For some reasons, I am not seeing an option to attach a workbook when I am replying to this.
Thanks so much.
- Mahesh
-
10. Re: Ranking within Hierarchy
ranjit saha Feb 20, 2017 6:01 AM (in response to Mahesh Ruikar)ok Mahesh.. try this:
you have created the State+city combined field.
Now create this cal func: "rank" with the formula - RANK_DENSE(sum({fixed [State]: sum([Invoice])}), 'desc')
now, arrange the dimensions and the cal fields as per this:
under marks: go to Rank cal and edit Table calc: as shown below:
Now when you expand or collapse the state.. the order will be maintained as per your choice.
Try and let me know.
Thanks,
Ranjit
-
11. Re: Ranking within Hierarchy
Sherzodbek Ibragimov Feb 20, 2017 7:11 AM (in response to Mahesh Ruikar) -
12. Re: Ranking within Hierarchy
Mahesh Ruikar Feb 20, 2017 12:39 PM (in response to Sherzodbek Ibragimov)Sherzodbek
This works perfectly however it forces me to have the combined filed which in my actual data I don't want to have. That's why I was inclined towards using rank however that is also not working (Ranjit's suggestions).
Both of you have provided some great tips, unfortunately, it's not working for what I want to achieve.
Thanks much.. I know it's probably frustrating for you as well...
- Mahesh
-
-
14. Re: Ranking within Hierarchy
ranjit saha Feb 20, 2017 4:39 PM (in response to Mahesh Ruikar)Mahesh, did you try sorting it.
For me it is working like a cake.