Bits of Tableau

Sort Charts Like a Pro in Tableau Dashboards

An Easy Way to Sort Visualizations Based on Multiple Measures using Parameters

Sharon Regina
3 min readMay 7, 2022

In this article, I want to share a useful tip that can give business users the flexibility to do custom sorting through a Tableau dashboard.

By the end of this read, you’ll be able to make a visualization where you can set the Top N instances, order the values by ascending or descending, and sort the values by multiple measures, as illustrated below.

Visualization Final Output by Author; Company Logo by Patrickss

Let’s get started with the tutorial then!

The dataset used is Tableau’s Superstore dataset and the objective is to visualize Superstore’s Top Performing States based on 4 measures: Count of Orders, Quantity, Sales, and Profit Ratio.

  1. Drag the needed Measures to Columns and Dimensions to Rows.
Unsorted Visualization by Author

2. Create a String Parameter to Order Values By Ascending or Descending Order.

Order Values By Parameter by Author

3. Create a String Parameter to Sort Values By the Measures.

Sort Values By Parameter by Author

4. Show the Parameters in the Visualization.

Show Parameters Created by Author

5. Create a @sort-by Calculation to Define the Parameters (Make Them Work) — I like to use ‘@’ to differentiate parameter defining calculations apart from other calculations.

@sort-by Calculation by Author

6. Right-Click — Sort the Dimensions (State & Regional Manager) and Sort By @sort-by Calculation.

Sort Edit Menu by Author

7. Sorted Results: Dimensions have been sorted based on the Order Values By and Sort Values By Parameters.

Sorted Results by Author

Yay! We have successfully created a custom sorting based on the multiple measures! Now, we want to add a Top N Filter to only display Top N instances in the visualization as a cherry on top.

8. Create an Integer Parameter to Set Top N Filter.

9. Create a @top-filter Calculation using the INDEX() function to Define the Set Top N Filter.

@top-filter Calculation by Author

10. Drag the @top-filter to the Filter Shelf and Set it to ‘True’ so that only values fulfilling the calculation will be displayed.

@top-filter Filter Menu by Author

11. Design the Dashboard and Display all the Parameters.

Visualization Final Output by Author; Company Logo by Patrickss

Congratulations! You now can sort the visualization based on the Count of Orders, Quantity, Sales, and Profit Ratio in Ascending or Descending order, as well as setting the Top N instances in the view.

For any inquiries, I can be contacted via LinkedIn. Hope this article can help you to make more impactful data-driven decisions by applying custom sorting parameters in your visualizations :).

--

--

Sharon Regina

Business Intelligence enthusiast that wants to learn more by sharing my experiences and research. **Views expressed here are solely my own & not my employer’s.