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:

  1. Manual sorting: Manual sorting is a sort that rearranges the order of dimension fields by dragging them next to each other in ad hoc fashion.
  2. Computed sorting: The computed sorting is a sort which is directly applied on the axis using the sort dialog button.
Tableau Data Sorting

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:

  • In all cases, one-click means sorts the data in ascending order, and two-click means it sorts the data in descending order, and three-click means clear the sorts.
  • If the underlying data changes, the sort will update correctly.
Tableau Data Sorting

Sort from an Axis

  • Float over a numerical axis to get the sort icon.
  • Click that icon to sort.
Tableau Data Sorting

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

  • Float over a header to get the sort icon.
  • Click that icon to sort.
Tableau Data Sorting

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.

  • For a field label, the sort icon is slightly different from an axis or a header. Alphabetical sorting is the default option, but there is also a menu for choosing to sort by a field in the view.
Tableau Data Sorting

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.

Tableau Data Sorting

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

  • If the sort icons do not appear, then this functionality may be turned off, or it cannot be possible to sort the view.
  • For example, Scatter plots cannot be sorted by a numerical axis because the data entirely determine the position of the marks. No sort icon will appear on the axis in scatter plots.

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.

  • The default behavior has to sort the deepest dimension If you do not select a field before sorting,

2. Choose the appropriate sort button such as ascending or descending order in the toolbar.

Tableau Data Sorting

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:

Tableau Data Sorting




Latest Courses