Custom Sort Control in Tableau
Mar 14, 2019
Klaus SchulteThis week I had a lot of fun recreating Lorna Eden’s #WorkoutWednesday2019 challenge. One key element was to implement a custom sort control (click to play with the interactive version on Tableau Public):
We should use a parameter to allow a sort by (city) A-Z, (city) Z-A, (profit) asc, and (profit) desc.
I really loved to see how everyone found her or his way to implement this.
First thing you need isto create is a sort parameter. I created this one:
I chose an integer parameter mainly because it is easier to reference in the calculated field you have to create in the next step.
Basically, there are two ways to do it:
Last step is to implemented it in the view:
Make sure to calculate the ranks on the right level of detail. In my case, I used a combined field of city and abbreviation, that’s why I had to compute my ranks using these dimensions.
For the final view I hid the sort view header and was ready to go.
Nice! 😊
There are many use cases for sort controls like this, allowing users to play with the sorting!
Hope you find own use cases for this and enjoyed reading.
3 COMMENTS
Arslaan Munir Khan says:
Do you have a video to explain the same. I am finding it really hard to follow the steps.
Holger Ihle says:
Thank you very much for sharing this approach. This is very helpful. I’m wondering if this is applicable to a worksheet with more than one column (measure) and multiple rows (categories). Say if you add SUM(sales) to columns and Region to the rows. What would be the neccessary adaptation to add sorting options for sorting by SUM (sales) as well.
Klaus Schulte says:
Hi Holger, you can use the same approach. Think I found you on twitter and I will send you a screenshot.