How to Switch Sorting by Specified Columns in a Viz with Dimensions in Rows and Columns

Published: 10 Aug 2023
Last Modified Date: 10 Aug 2023


How to switch sorting by specified columns in a viz with dimensions in Rows and Columns.



  • Tableau Desktop


The following is an example of sorting by Sales in descending order according to the Region selected by the parameter.

User-added image

1. Create a parameter as follows;
 User-added image
2. Right-click Sort by parameter and select Show Parameter.
3. Create a calculated field and name it Sort by Field.
{ EXCLUDE [Region]:SUM(IF [Region] = [Sort by] THEN [Sales] END) }
4. Add Region and SUM(Sales) to Columns.
5. Add YEAR(Order Date) and SUM(Sort by Field) to Rows.
6. Right-click SUM(Sort by Field) in Rows and select Discrete.
7. Right-click SUM(Sort by Field) in Rows and uncheck Show Header.
8. Right-click YEAR(Order Date) and select Sort. Configure it as follows;
 User-added image
Did this article resolve the issue?