Tableau Tips: Nested sorting not as expected- a simple fix

Many students have been confused about the Tableau data sort behavior.   A common question is how to sort the data at a lower level correctly within each higher level of data in a view.   One student recently came to us with this view and asked, “What’s up? I thought it would sort each state independently within each Product Type! In the first group, Herbal Tea, Nevada is clearly number one yet it is shown in the fourth position.”

 

Tableau_Tips_Nested_Sorting_1_Freakalytics

 

Solution

I replied that Tableau was sorting State overall across every product type once for the entire table and then displaying this sort order for every Product Type.   She said this is “stupid, how can I fix it! I wasted hours trying to fix it already.”

Login to see the solution including a solution workbook! If you haven’t joined Freakalytics yet, it’s free and easy.   Just click signup.

1)           I showed her this view to prove what it was doing.   Remove Product Type from the Rows shelf.   See, it’s the same sort order as your view!

Tableau_Tips_Nested_Sorting_2_Freakalytics

2)           In the Data pane, <CTRL+Click> on Product Type and State, then <Right click> and select Combine Fields.  A new data item appears, Product Type & State (Combined).

3)           Add Product Type & State (Combined) to the Rows shelf after Product Type.   Add State after Product Type & State (Combined).

4)           Click Product Type & State (Combined) on the Rows shelf, select Sort on the drop-down and Sort like this. Click OK.

Tableau_Tips_Nested_Sorting_3_Freakalytics

5)           You should now see a beautiful sight, Tableau is finally sorting the data within each level! Download the solution workbook here (it’s a compressed folder containing the packaged workbook).

Tableau_Tips_Nested_Sorting_4_Freakalytics

 

Freakalytics
This is brought to you by the leading independent Tableau training source, Freakalytics.   We offer training focused on solving real-world problems with your data, Tableau and other relevant analytic tools and technologies.   Please contact us if we can be of service with on-site training at Info@Freakalytics.com

Freakalytics has trained thousands in public and on-site classes around the world, including founding and authoring Tableau’s training program back in 2009, writing the first Tableau book (now in the 4th edition), teaching at multiple Tableau world and European conferences and direct leadership roles at Tableau with the founders, guiding the future of Tableau Desktop.   We are also the authors of The Accidental Analyst, SAS for Dummies, The Rapid Dashboard Reference Card and have been on the faculty of The American Marketing Association and The Data Warehouse Institute.


Share the power of R shiny apps across the entire team with YakData
The team at Freakalytics has built YakData brightRserver, our new cloud platform.

Securely share R shiny apps
Develop R shiny apps
All on one dedicated, secure and powerful platform.

Subscribe and keep in touch with us!