Sorting tables like a breeze
Tableau is a visual tool and using graphs (especially bars and lines) is much better practice than tables. However, clients very often insist on using tables as that’s what they are used to, transitioning from Excel. In that case, it is best to visualize the same information with bars and an interactive table and let the user flick between them.
Sorting a dimension with a single click on its title makes the dashboard much more intuitive and user-friendly. This is one of the tricks that I use quite often with the clients as they just love tables! In this post, you will find step-by-step instructions on how to do this.
After we create our table, we want to ‘Hide Field Labels for Rows’ and create our own headers. At first, we have to create a MIN(0) calculated field for each column.
Create a new sheet, drag all the created MIN(0) values to the Columns shelf. Hide the headers to get rid of the axis and titles. Change the Mark type on All for Text, place Measure Names on the Text for All and then change the text for each green pill to Quantity, Sales, and Days to Ship. Format to remove the gridlines and zero lines. At last, remove the tooltips.
Now we have to create a Sort Parameter:
We then create a calculation to work with our Sort Parameter:
There are SUMs in this calculation as [Days to Ship] is an aggregated field and we cannot mix aggregated and non-aggregated fields.
The next step is adding the newly created sheet with headers to the dashboard and creating a Dashboard Action. We choose ‘Add Parameter Action’ with the header selected as a Source Sheet, Sort Parameter as Target Parameter, and Measure Names as Field. This action will run on Select.
Now we have to go to our created table and set up the sort of the first dimension - Order ID:
At this point sorting should technically work with each click of the header, however, it is not ideal because we can see that the other headers became grey, and moreover, there is some ugly shading on the selected header.
To get rid of this, we are going to create a deselection action. At first, we create 2 Ad-hoc calculations – they are created directly in the view. To create the Ad-hoc calculation, we just need to double click on the empty space. We create one for TRUE and one for FALSE. We then save them by dragging the pills to the Data Pane.
The next step is adding a Dashboard Action to make this deselect work. We choose filter action with a header in the Dashboard as the source sheet and header sheet as the target. It is crucial we click on the Selected Fields in Target Sheets and add TRUE and FALSE just like on the next photo below.
We got rid of the ugly shading and all headers have the same font but now there is no way to distinguish which dimension currently sorts the view. We would like to add a little arrow to change that. In order to do that we need to create a calculation for each dimension header:
We can copy the arrow character from this page: https://fsymbols.com/signs/triangle/
We place the created calculations on the text shelves of the responding dimensions e.g. ‘Sorted on Sales’ on ‘Sales’ etc and edit the text box.
Now we should be able to see an arrow below the selected dimension that sorts the table.
This simple method allowed us to create a more intuitive table. Despite not using bars we can very quickly find out the top customers for Quantity, Sales, and Days to Ship, making the transition from Excel to Tableau a bit smoother for the end-user.
Empower your organization with intuitive analytics
Tableau is designed to put the user first because data analysis should be about asking questions and not about learning software. With built-in visual best practices, Tableau enables limitless visual data exploration without interrupting the flow of analysis.
As the market-leading choice for modern business intelligence, the Tableau platform is known for taking any kind of data from almost any system and turning it into actionable insights with speed and ease. It’s as simple as dragging and dropping.