Tableau Data Sorting
In the data source, data can be stored based on the user requirement. It can be sorted using data source order such as A to Z ascending, Z to A descending, A to Z ascending per table and Z to A descending per table.
Once the data is connected with Tableau, data sorting is done using the Sort Fields option. The Sort Fields option is present in the Data Source tab.
There are two ways to sort the data in Tableau:
When viewing a visualization, data can be stored using the single-click option from a header, an axis or field label.
Quick Sort from an Axis, Header and Field Label
There are many ways to sort a visualization with single click sort buttons:
Sort from an Axis
In the above example, the sort is applied on Color rows based on the values of Metric A. If there are hierarchical dimensions shown in above example, that type of sort is used on the inner dimension. Here, it means that Color rows will sort inside Hue. Dark magenta cannot be sorted at the top of the viz because it should stay inside the Purple Hue.
Sort from a Header
In the above example, the sort is applied to a Material column such as Paint, Paper and Fabric based on the values of Green since the header is used for the sort.
Sort from a Field Label
1. Float over a field label to get the sort icon.
2. Click on the A-Z icon to sort alphabetically, or open the menu to see a list of fields which is possible to sort according to the field. Then, click on sort after the icon switches to the bar icon.
In the above example, the sort is applied to the outermost dimension such as Hue is based on Metric B. (Metric B is aggregated for all the colors inside each Hue, and Hue is sorted as first is Purple, then Green, then Blue.)
Missing Sort Icons in Tableau
Sort Options While Authoring in Tableau
In an authoring environment, there are some additional sorting options, such as:
Sort from the Toolbar
1. Select the dimension which you want to sort.
2. Choose the appropriate sort button such as ascending or descending order in the toolbar.
In the above example, the sort is applied on Hue unless the Material field is selected before sorting. In the case of Metric B, the toolbar sort applies to the leftmost measure.
And to sort by Metric A, it would be necessary to use another method of sorting or reverse their order on the Columns shelf. (To see the effect of sorting by Material, Hue is removed from the view. this makes it easy to see how the sort is computed.)
Sort by Drag and Drop
To sort manually, select a header in Viz or on a legend and drag it to the current location shown below: