Loading

Sorting Segments Within Stacked Bars by Value

Udgivelsesdato: Feb 24, 2026
Opgave
How to sort color segments by value within the stacked bars rather than by value across all the stacked bars.

For example, chart A is a regular stacked bar chart, and chart B is sorted by values within the stacked bar.
Chart AChart B
User-added imageUser-added image



 
Trin

Step 1: Create the View

  1. In Tableau Desktop, connect to Superstore sample data.
  2. Drag Category to Columns.
  3. Drag Sales to Rows.
  4. Drag Region to Color.
  5. Drag Sales to Label.

Step 2: Sort the Bar Segments

  1. On Color, right-click Region, and then select Attribute.
  2. In the Dimensions pane, hold down the CTRL key, click Category, and then click Region.
  3. With the dimensions highlighted, right-click Region, and then select Create > Combined Field.
  4. Drag Category & Region (Combined) from Dimensions to Detail.
  5. On Detail, right-click Category & Region (Combined), and then select Sort.
  6. In the Sort dialog box, do the following, and then click OK:
    • For Sort Order, select Descending.
    • For Field, select Sales.
    • For Aggregation, select Sum.

To view these steps in action, see the video below:
Yderligere ressourcer
By default, stacked bar charts sort along the total for the dimension in the Color shelf.
Vidensartikelnummer

001458243

Vedhæftede filer

Stacked Bar Sorting.twbx

391 KB

 
Indlæser
Salesforce Help | Article