How to create Multilevel or Nested Sorting in Tableau
Hello friends! Today we’ll be learning how to create multilevel sort/Nested sorting in Tableau. Since there is no direct option present to sort multilevel in Tableau. There are two method to achieve multilevel/nested sorting in Tableau.
Method 1:
Create the chart/viz as shown below. Here State and region are in the hierarchy and the
problem is that it’s not sorted based on the values but based on the region. And the use case is show the sales of regions for a states in decreasing/increasing order.
Now create a calculate field ‘Combined dimension’ to concatenate the dimensions as
State + Region
Or Select both the fields and right-click > Create > Combined field as shown below.
Now place calculated field or combined field we just created in the between the State and Region and complete the following steps.
a. Right-click > click sort > select the sort order( decreasing/increasing) > sort by field as sales (or the measure you have taken).
b. Right click on the calculated or combined field and unselect the show header. That’s done(see below image for reference).
Once all the steps are completed we’ll get the desired result as shown.
Method 2:
Create a calculated field ‘Rank’ as shown below, change the measure as required here I have taken Sales.
Rank(Sum([Sales]))
Place the calculated field in the middle of the State and region. Click on the Rank
calculated field and select table calculation as Pane(down) and uncheck show header and
that’s done (shown in the image below).
Check out tutorial Top N values Sub-Category Wise in Tableau
This was about how to create multilevel/nesting sorting in Tableau.
Thanks for reading! Comment your suggestions or queries.
Keep visiting Analytics Tuts for more tutorials.
Now, can you also sort the states by their cumulative totals?? In this viz, Texas should be on top followed by CA, FL, and HI. That’s a real trick.
By creating the new calculated field to get the tolal sum at state level and sorting at 2 levels
I’m new to Tableau, learning & researching on tableau. Informative tutorial.