How to Add Totals to Stacked Bars in Tableau

Adding totals to the tops of bars in a chart is sometimes as simple as turning on by selecting Show Mark Labels in the toolbar. However, when the bars are broken down by color or size, each segment is labeled, rather than the total for the bar. With a few steps, you can add the total to the top of every bar for either horizontal or vertical bar charts such as the one below:

Add a reference line

You can use a reference line to automatically calculate the totals.

Step 1

Right-click the continuous axis and select , Add Reference Line, Band, or Box.

Step 2

In the subsequent dialog box, select Line as the reference line type.

Step 3

Under Scope, select Per Cell.

Step 4

In the Line area, select a measure and an aggregation for the Value. In example, we'll use Sum(Sales) and SUM.

Step 5

Select to Label the line with the Value.

Step 6

In the Formattingarea, change the Line to None.

Step 7

When finished, click OK.

Align the totals

The total is now displayed for each bar, but the numbers are left aligned.

Step 1

Right-click any of the totals on the bar chart and select Format.

Step 2

In the Format window, in the Reference Line Label area, open the Alignment control and select the Center option forHorizontal alignment.
The totals are now center aligned.