Sorting is vital feature for analysing the data. There are various ways to sort the data in tableau. Sorting can be achieved with basic techniques to advance ones. Let’s go through different methods of sorting.
Sorting through Icons / Toolbar
The simplest method to sort is via toolbar icons. This icon can sort the chart in both ascending and descending direction. Below image describes the sorting via toolbar icon. The chart is sort by sum of sales in descending order.
Tableau also gives sorting icons near the dimension header and over the chart. Usually, to see these icons, we have to hover cursor over/near the dimension heading or above the chart. By clicking this icon we can accomplish same sort as toolbar icon.
Sorting Icon can be alphabetical values as well. As per below image. If we Click on the AZ symbol near the dimension header. By default, the result is sorted in alphabetical order of the dimension values. Clicking on the symbol will sort the result in reverse alphabetical order.
Sorting through Sort Menu
The advanced sorting can be opened by clicking the little triangle on the dimension pill in row/column section and select the sort option. Clicking on the sort option, it opens the dialogue box. There are two options available. “Sort By” and “Sort Order”. We will have multiple options (dropdown) of sorting under the section of “sort by”. As displayed in below screenshots.
Let's have a look at each "Sort By" options.
Data Source Order : This order is basically the alphabetical order.
Alphabetical: This sorts the result in alphabetical order of dimension values.
Field: By clicking on Field sort we will have two more section on the dialog box named “Field Name” and “Aggregation”. Field Name can be any field from the data regardless of dimension/continuous and it is not necessary to be available in chart/visualization. For example, you could also apply ascending sort by average profit. In Aggregation, we can select the necessary aggregation function depending on the categorical/continuous data. For example, we can select the city in the filed section, city is a dimension value and not a measure. So, Tableau automatically applied the Count function in the Aggregation section.
Manual :This type of sorting can be achieved two ways. First, by clicking and dragging the desired value from the chart and dropping at bottom / top of the chart. As per the below screenshots.
Second, using the Sort By menu option of Manual. we can move upward or downward a desired value based on the position we want. Described in below image.
Nested: This is little complex type of sorting option. The Nested sort is useful if we aim to sort a dimension within another dimension (hierarchy) over a measure. For example, we will sort category and sub-category by sum of sales in ascending or descending order.