How to sort Tableau visualization by measure

Posted on Mar 22, 2022

A quick guide on different ways you can sort your data in Tableau.


When creating a visualization with Tableau, you can sort your data in different ways depending on the end result you want to achieve.

One of the ways to sort your data is by sorting a dimension field by a measure field.

To show you an example, I have created a bar graph that shows the Total Sales of each Item field as follows:

Here, I can sort the Item by the amount of Total Sales by clicking one of the two sorting icons on the top bar:

The icons will automatically sort the Item dimension based on the Total Sales value for each Item:

Alternatively, you can also manually specify the sort options by right-clicking on the dimension you want to sort and selecting the Sort… option.

In the following screenshot, the Sort… option for the Item dimension is selected:

A sorting window will appear on the screen. You can specify the sort option whether by Field or Alphabetic name of the data inside the dimension.

To sort the dimension by a specific measure, you need to select Field as the Sort By value.

Next, determine the Field Name, the Sort Order, and the Aggregation method that will be used for the sorting operation.

You can even use a dimension or measure field that you haven’t added to the sheet as the Field Name value:

And that’s one example of how you can sort Tableau visualization by a measure field.

You can view and download the Workbook for this tutorial here:

Tableau Sort By Measure Example

Keep in mind that you can only sort dimension fields and not measure fields.

This is because continuous fields (measures) cannot be sorted. You can only sort discrete fields (dimensions).

Still, measures aggregated and grouped under dimensions can be used to sort the dimensions, as shown in the example above.

I hope this tutorial has been useful for you. 🙏

Level up your programming skills

I'm sending out an occasional email with the latest programming tutorials. Drop your email in the box below and I'll send new stuff straight into your inbox!

No spam. Unsubscribe anytime.