Recently, I created a stacked bar chart to compare the product sales across the regions. In that chart, I faced an issue where the segments within each bar followed the same global order. That meant every bar was sorted in descending order by its overall value, rather than by the values from each bar.
For example, in the East region, Furniture was the top seller, while in the West, Technology was leading. But Tableau wasn’t showing that difference because it was showing the same order across all bars.
As a solution, I combined the values and sorted the segments within the stacked bars by value. With this method, each bar’s segments were sorted separately to see which category is contributing the most within each group.
In this Tableau tutorial, I will explain how to sort values in a Tableau Stacked bar chart with global sorting and sorting in each bar.
Sort Stacked Bar Chart in Tableau by Values
To sort the stacked bar chart in Tableau by values, there are two approaches: basic and advanced sorting.
- Sort values in a Tableau stacked bar chart with global sorting
- Sort values in a Tableau stacked bar chart in each bar by segments
Sort Values in Tableau Stacked Bar Chart With Global Sorting
In this method, we will sort the bars by total, and the segments within the bars follow a single global order.
Connect the Tableau with the Superstore dataset and follow the steps below to create a stacked bar chart with global sorting.
- Drag the Category to the Columns and Sales to Rows. With this, we will get the bar chart showing sales for each category.

- To stack the bars, add the region to the Color card in the Tableau.

- To display the sales values for each region in the category bars, add ‘Sales’ to the Label card in the Marks section.

- To add sorting, click on the Category in the Columns and select Sort. In the next window, select “Sort by” as “Field“. After this, select the Sort Order and then choose the measure of sorting (Sales).

With this, bars are ordered by total Sales, and all segments follow the same global order.

This way, we can sort the values globally in the Tableau stacked bar charts by following the above steps.
Sort Values in Tableau Stacked Bar Chart in Each Bar by Segments
In this method, we will apply advanced sorting, where the values will be sorted in increasing or decreasing order individually in each bar.
Connect the Tableau with Superstore data and follow the steps below.
- To create the stacked bar view, drag Category to Column, Sales to Rows, Region to Color, and Sales to Label.

- For sorting, go to the Color card, right-click Region, and then select Attribute.

- In the Dimensions pane, hold the CTRL key, click Category, and then click Region. Now, right-click Region, and then select Create > Combined Field.

- Click on the Category & Region detail card and select Sort.

- In the Sort dialog box, do the following, and then click OK.
- In the Sort By, select Field.
- For Sort Order, select Descending.
- For Field, select Sales.
- For Aggregation, select Sum.

With this, we can see that each bar now sorts its own segments based on the segment’s contribution within that bar.

This way, we can sort values in a Tableau stacked bar chart in each bar by segments.
Conclusion
In this Tableau tutorial, we have learned how to sort values in a Tableau stacked bar chart in two ways. In the above examples, by using global sorting, all bars are displayed in the same order. In another method, by sorting within each bar, where segments are arranged based on their contribution in that specific bar.
You may also like to read:
- Tableau Gantt Chart With Milestones
- Funnel Chart With Multiple Measures in Tableau
- Tableau Combination Chart

Abhijeet is a skilled Salesforce developer with experience in developing and integrating dashboards, data reports, and Salesforce applications. He is also skilled at optimizing processes and flow automation processes, coding, and executing complex project architecture. Read more about us | LinkedIn Profile.