Sort Values in Tableau Stacked Bar Chart : Abhijeet

Sort Values in Tableau Stacked Bar Chart
by: Abhijeet
blow post content copied from  SalesForce FAQs
click here to view original post



### Summary of the Content The content discusses how to create and sort a stacked bar chart in Tableau to compare product sales across different regions. Initially, the author encountered a problem where all segments in the stacked bars were sorted globally, meaning they followed the same order regardless of the individual bar's values. For instance, while Furniture was the best-selling category in the East region, Technology led in the West, but this distinction was lost due to the global sorting. To resolve this, the author explains two methods for sorting the stacked bar chart: 1. **Global Sorting**: This method sorts all bars based on total sales, with segments following a single order. The steps involve dragging the necessary fields into the Tableau workspace and adjusting the sorting options to sort by total sales. 2. **Sorting by Segments**: This advanced method allows each bar to sort its segments individually based on their contribution. The author provides detailed steps to create a combined field for sorting and how to adjust the sort settings for each segment. The tutorial concludes by summarizing the two sorting methods and suggests additional reading on related Tableau chart types. ### Key Details - **Issue Identified**: Global sorting led to loss of individual bar distinctions. - **Solution**: Two sorting methods—global sorting and sorting by segments. - **Tools Used**: Tableau software with the Superstore dataset. - **Outcome**: Improved clarity in sales data representation. ### Additional Context Tableau is a powerful data visualization tool widely used for business intelligence. Understanding how to manipulate data visualizations, such as stacked bar charts, is crucial for effective data analysis and presentation. The ability to sort data appropriately can significantly enhance the insights drawn from visualizations. ### Hashtags for SEO #Tableau #DataVisualization #StackedBarChart #BusinessIntelligence #DataAnalysis #TableauTutorial #SalesData #DataSorting #TableauTips #SuperstoreDataset


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.

  1. Drag the Category to the Columns and Sales to Rows. With this, we will get the bar chart showing sales for each category.
Sort Values in Tableau Stacked Bar Chart
  1. To stack the bars, add the region to the Color card in the Tableau.
Tableau stacked bar chart sort values
  1. To display the sales values for each region in the category bars, add ‘Sales’ to the Label card in the Marks section.
Tableau stacked bar chart sorting
  1. 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).
Sort Values in Descending in Tableau Bar chart

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

Global sorting for values in Tableau

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.

  1. To create the stacked bar view, drag Category to Column, Sales to Rows,  Region to Color, and Sales to Label.
Tableau stacked bar chart with sort values
  1. For sorting, go to the Color card, right-click Region, and then select Attribute.
Sort Values by segment in Tableau
  1. In the Dimensions pane, hold the CTRL key, click Category, and then click Region. Now, right-click Region, and then select Create > Combined Field.
Value sorting in Tableau Stacked bar chart
  1. Click on the Category & Region detail card and select Sort.
Tableau value sorting in Stacked bar chart
    1. 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.
    Sorting Segments Within Stacked Bars by Value

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

    Tableau stacked bar chart by sorting segments

    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:

    The post Sort Values in Tableau Stacked Bar Chart appeared first on SalesForce FAQs.


    September 06, 2025 at 10:13PM
    Click here for more details...

    =============================
    The original post is available in SalesForce FAQs by Abhijeet
    this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
    The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
    ============================

    Salesforce