Nested sort to add multilevel sorting on the view in Tableau

Sometime, there is the case when you sort items, for example to sort the students according to their scores, it happens  that many students have the same score. Then you might want to have a second sorting saying, for instance, among those students with the same scores, sort according to the time they need to finish the test. And so on and so forth, you could build multilevel sorting for your analysis. This blog show you a way to do it in Tableau.

Example of today:

There is a list of websites with their titles, stars (rating/ranking) and languages.

Now this is my 2 level of sorting allowing users to choose items they want.

According to the current choice, the list will be sorted by language first (alphabetically), and for those websites with the same language, they will be sorted after the number of stars. And by default, the websites with same language and number of stars will be sorted by the title alphabetically. Let’s start.

1.Create parameter for each sorting

For each one, create a parameter with a list of items you want to put on the sorting.

2. Create a calculated field for each parameter

Note that they should be string.

3. Combine them

Here you can put as many fields as you want.

4. Sort by

Right click on the field you want to sort (here is the title), chose Nested type under Sort By and the Field Name is the combined calculated field we just created.

Note that I put everything “Ascending” here. For the Starts the rating field should be reversed if you want only the stars to be in descending order like me. Otherwise it will sort the stars in order from few to many.

Now you can sort by different fields in order.

Author:
Nhung Le
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2024 The Information Lab