Tableau Tips : Selecting Sort Order

In Today’s Tableau tip we will see how to give user control for Selecting Sort Order of a given chart. Lets say that we have the sales of subcategories from our Super store data as under:
Now from our end we can change the sort order ( ascending/descending ) using the sort icon available on the application. However the end user will not be able to see this option and will not be able to change the sort order.
We can give the control to the end user to change the sort order with the help of a parameter. Here’s how to do that.
Create a parameter Sort Order as under to sort the sales:

Create a measure for sales which is actually the product of sales and our created parameter which has values of 1 and -1
Once the measure and parameter are created right click on the Sub Category Dimension on the Rows and select Sort . In the pop up window that appears click on Sort by field and in dropdown select Sales 2. Keep the aggregation as sum.
We are good to go now.  Right click on the parameter that we created and click on show parameter control. Select the option Ascending/Descending from the dropdown and the order will change automatically.
The following workbook shows the working of what is described above:

Hope you guys found it useful.

Rahul Singh

Please follow and like us: