How to Sort by Measure in Tableau

Cody Schneider••7 min read

Sorting a bar chart by its values seems like it should be simple, but wrestling with Tableau to get it just right can sometimes feel like a chore. You know the insight is in your data, but if it isn't presented clearly, your audience might miss the point. This article will walk you through several straightforward methods to sort your visualizations by a measure in Tableau, from one-click toolbar shortcuts to more controlled techniques for precise data storytelling.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Why Sorting in Tableau is a Game-Changer

Sorting isn't just about making your charts look tidy, it's a fundamental part of data analysis that directly impacts how you and your audience interpret information. When you intentionally order your data, you make it much easier to spot trends, identify outliers, and focus on what truly matters.

  • Highlights Key Performers: Instantly see which products generate the most revenue, which marketing campaigns have the highest ROI, or which sales regions are lagging.
  • Improves Storytelling: A chart sorted from highest to lowest value immediately draws the eye to the most significant contributors, creating a clear narrative for your audience.
  • Speeds Up Decision-Making: When data is logically organized, you can pull insights in seconds instead of minutes, enabling faster, more informed decisions.

For example, if you're analyzing sales data, sorting sub-categories by sales in descending order immediately shows you where the bulk of your revenue comes from. It’s a simple action that transforms a confusing chart into a clear, actionable insight.

Method 1: The Quickest Sort with Toolbar Buttons

The fastest way to sort your view in Tableau is by using the one-click sort buttons on the toolbar. This is perfect for quick, ad-hoc analysis when you just need to see your data ordered immediately.

Let's use a common example: a bar chart showing Sales by Sub-Category from the Sample Superstore dataset.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Step-by-Step Instructions:

  1. Create a simple bar chart. Drag the Sub-Category dimension to the Rows shelf and the Sales measure to the Columns shelf.
  2. You'll now see a horizontal bar chart. Look at the toolbar at the top of your Tableau workbook. You will find two sort icons: one for ascending order and one for descending order.
  3. Click the Descending Sort button (the icon with bars getting smaller from top to bottom) to arrange the sub-categories from the highest sales to the lowest.
  4. Click the Ascending Sort button (the icon with bars getting larger) to do the opposite.

This method works by automatically sorting the dimension on the Rows or Columns shelf (in this case, Sub-Category) based on the measure that’s also in the view (Sales). It’s fast, easy, and incredibly efficient for basic sorting needs.

Method 2: Sorting Directly from an Axis

Another intuitive way to sort your data is by interacting directly with the axis of your measure. This method feels very natural and gives anyone viewing your dashboard an easy way to re-order the data on the fly.

Step-by-Step Instructions:

  1. Using the same Sales by Sub-Category bar chart, move your mouse cursor over the Sales axis label at the bottom of the chart.
  2. A small sort icon will appear just to the right of the axis title.
  3. Click this icon once to sort the chart in descending order by Sales. You’ll see the bars immediately rearrange.
  4. Click the icon a second time to sort in ascending order.
  5. A third click will clear the sort and revert to the default ordering (which is typically alphabetical/data source order).

This interactive sorting feature is excellent for dashboards because it empowers end-users to explore the data for themselves without needing to be Tableau experts.

Method 3: Gain More Control with the Right-Click Sort Menu

While the first two methods are great for speed, sometimes you need more control. What if you have multiple measures in your view, or you want to sort by a measure that isn't even displayed on an axis? The right-click context menu is your answer.

This method allows you to explicitly define which field to sort by and how to aggregate it.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Step-by-Step Instructions:

  1. On the Rows shelf, right-click the blue Sub-Category dimension pill.
  2. Select Sort... from the dropdown menu. This opens the Sort dialog box.
  3. In the Sort dialog box, you'll see several options. Under Sort By, select Field.
  4. For Sort Order, choose either Ascending or Descending.
  5. In the Field Name dropdown, select the measure you want to sort by. For our example, choose Sales.
  6. The Aggregation will likely default to Sum, which is correct for our view. This confirms you're sorting by the sum of sales for each sub-category, not the average or count. Always double-check this setting to make sure it matches your visualization.
  7. Click OK.

The bar chart will now be sorted according to the exact specifications you've set. This method is the most reliable way to ensure your sort is applied correctly, especially in more complex worksheets with multiple dimensions and measures.

Advanced Method: Use a Calculated Field for Custom Sorting

What if you want to apply a sort based on logic that's more complex than just ascending or descending order? For example, maybe you want to rank categories or create a custom sort order. This is where calculated fields become incredibly powerful.

Let's use a calculated field to sort our sub-categories by their sales rank.

Step-by-Step Creation of the Calculation:

  1. In the Data pane, right-click on an empty area and select Create Calculated Field...
  2. Name your calculation something descriptive, like Sales Rank.
  3. In the formula box, enter the following table calculation:
  4. Click OK.

Applying the Calculation to Sort:

  1. Drag your newly created Sales Rank field from the Data pane to the Rows shelf, placing it to the left of the Sub-Category pill.
  2. Tableau will initially treat this as a continuous measure (a green pill), which isn't quite what we want. Right-click the Sales Rank pill and choose Discrete. The pill will turn blue.
  3. Your chart is now sorted by sales rank! The highest-selling sub-category will have a "1" next to it, the second-highest will have a "2," and so on.

Using a calculated field gives you ultimate flexibility. You could write more advanced formulas to sort by profit ratio, group negative performers at the bottom, or even integrate parameters to let users choose how the data is ranked dynamically.

Common Sorting Problems and Solutions

Sometimes, sorting in Tableau doesn't behave as you'd expect. Here are a couple of common issues and how to fix them.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Why is the toolbar sort button grayed out?

This usually happens when Tableau can't determine a single, clear measure to sort by. For example, in a text table with multiple measure columns, the simple toolbar sort doesn't know which column you intend to sort. In this case, use the right-click method on the dimension you want to order to explicitly choose the sorting measure.

My sort order seems wrong, what's happening?

If the sort isn't what you expected, check two things:

  1. Aggregation Level: Go back to the Sort dialog box (Method 3) and ensure the aggregation (e.g., Sum, Average, Median) matches what you need. Sorting by SUM([Sales]) is very different from AVG([Sales]).
  2. Filters and Other Dimensions: A filter or another dimension in your view could be affecting the calculation. For example, if you filter to a specific region, your sort will only apply to the data within that region. Be mindful of how all the elements in your worksheet interact.

Final Thoughts

Mastering sorting in Tableau is about choosing the right tool for the job. From the instant gratification of the toolbar buttons to the surgical precision of calculations, each method helps you craft a clearer data story. By organizing your data effectively, you guide your audience to the most valuable insights and empower them to make smarter, data-driven decisions.

Learning the ins and outs of a powerful tool like Tableau is incredibly rewarding, but we know firsthand that not everyone has the time to become a data visualization expert. We built Graphed to make sophisticated data analysis accessible to everyone, regardless of technical skill. Instead of struggling with menus and settings, you can simply ask for what you need in plain English. A request like "Show me a bar chart of my top 10 products by revenue last quarter" instantly generates a perfectly sorted visualization, letting you skip the manual work and get straight to the insights.

Related Articles