Nested sorting in dimension hierarchies Tableau

0 votes
I'm working on a Tableau visualisation with a dimension hierarchy (Product category, product sub-category, product type, and so on) sorted by number of orders. I want my viz to show only the first product level (product category) sorted the same manner by default, but with the opportunity to dig down to specific product levels using nested sorting (using "+" on the dimension) (again, descending by number of orders).

data from a superstore

For each product level, I tried utilising the nested sorting option, however as I dig up and down again, the sorting is incorrect again, as if it clears out. I can't seem to discover a way to keep them fixed unless I keep all product tiers in the viz accessible (without drill-down option).

Is there anyone who can tell me how to do it? I also attempted several indexing and ranking calculations, but none of them seemed to work. I know there's a way to mix hierarchy dimensions and use the sorting option on them, however it makes the viz seem a lot messier.

Thank you so much in advance!
Mar 24, 2022 in Tableau by Neha
• 9,020 points
1,108 views

1 answer to this question.

0 votes

Tableau will always sort by the column on the left. You may conduct a secondary sorting more simply using the updated nested sorting. When you extend up and down hierarchies, as you are doing now, the formatting may not be preserved.

The "traditional" method is to construct a Rank based on the quantity of orders (sounds like you were close on this one). COUNT([Order ID]),'desc'), rank(COUNT([Order ID]),'desc'). Make this a distinct measurement and place it to the left of the others.

image

To clean it up, you can uncheck "Show Header" on the rank pill.

image

And if you expand/collapse the hierarchy, it keeps the sorting... Final product:

image

EDIT: Here is another way to try to accomplish this. It seems to work for 3 levels but starts to break down after that. (It also didn't seem to work well on grouped dimensions.)

  1. Expand the hierarchy to all three levels.
  2. On each dimension, enforce a sort order of Count of Order ID Descending.

Sort button

Sort parameters

Master data visualization with our Tableau Training and unlock powerful insights from your data.

answered Mar 29, 2022 by Vaani
• 7,070 points

Related Questions In Tableau

+1 vote
1 answer

How to perform top N fields with nested sort in tableau

You can use the following steps: Sort 'State' ...READ MORE

answered Aug 4, 2018 in Tableau by ffdfd
• 5,550 points
4,263 views
0 votes
1 answer

In Tableau, how to pass measure/dimension to action filters that are not in the chart?

Hi Sindhu,  You can choose the fields that are ...READ MORE

answered Mar 11, 2019 in Tableau by Cherukuri
• 33,030 points
5,479 views
0 votes
1 answer

Sorting Attribute Date in Tableau

Hi,  You can sort date field in ascending/descending ...READ MORE

answered Mar 12, 2019 in Tableau by Cherukuri
• 33,030 points
21,533 views
0 votes
1 answer

How to form user made hierarchies in tableau to drill up/down fields?

Hi Prakash, It's easy to make hierarchies to ...READ MORE

answered May 9, 2019 in Tableau by anonymous
• 33,030 points
1,638 views
0 votes
1 answer

How can I convert a dimension into a measure in Tableau

I'd like to ask a technical question ...READ MORE

answered Apr 5, 2022 in Tableau by Neha
• 9,020 points
1,198 views
0 votes
1 answer

How can I Sort an ArrayList in Java

You can sort the ArrayList in 2 ...READ MORE

answered Apr 23, 2018 in Java by sharth
• 3,370 points
833 views
0 votes
1 answer

How to order data frame rows according to vector with specific order using R?

You can try using match: data <- data.frame(alphabets=letters[1:4], ...READ MORE

answered Apr 30, 2018 in Data Analytics by Sahiti
• 6,370 points
7,397 views
0 votes
1 answer

Sorting data into appropriate key in an object

I think that your code has an ...READ MORE

answered Jul 17, 2018 in Blockchain by aryya
• 7,460 points
587 views
0 votes
1 answer

Plotting multiple lines in Tableau

First, drag & drop measure values & ...READ MORE

answered Mar 14, 2022 in Tableau by Vaani
• 7,070 points
1,344 views
0 votes
1 answer

Creating a stacked waterfall chart in tableau

You can try this as a solution: 1.) ...READ MORE

answered Apr 5, 2022 in Tableau by Vaani
• 7,070 points
1,461 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP