How to Show Totals on Stacked Bar Chart in Tableau
Creating a beautiful stacked bar chart in Tableau is a great first step, but it often leaves your audience asking one key question: "What's the total for each bar?" While stacked bars are fantastic for showing part-to-whole relationships, they make it difficult to compare the overall totals at a glance. This guide will walk you through the clear, step-by-step methods to add those essential grand totals right on top of your bars, making your visualizations instantly more readable and impactful.
Why Total Labels Matter on a Stacked Bar Chart
Imagine you've built a chart showing quarterly sales, with each bar stacked by product category. You can easily see that, say, 'Technology' made up a larger portion of sales in Q4 than in Q1. However, you can't easily answer which quarter had the highest overall sales. Was the smaller 'Technology' slice in Q1 part of a much smaller total, or was the Q4 total just slightly larger? Eyeballing the top of the bars is imprecise and prone to error.
Adding a total label at the top of each bar removes all ambiguity. It provides your audience with two key layers of information in one clean visual:
- The Composition: The colored segments of the stack show the breakdown.
- The Total: The label on top provides the complete value for easy comparison.
This simple addition transforms your chart from a good visualization into a great one that tells a complete story without forcing your viewers to do mental guesswork.
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.
Method 1: The Quickest Way Using a Reference Line
Using a reference line is the most common and straightforward method to add totals to your stacked bars. It’s clean, efficient, and built right into Tableau's analytics features. Let's start by building a basic chart first.
Step 1: Create a Basic Stacked Bar Chart
To demonstrate, we'll use the "Sample - Superstore" dataset that comes with Tableau. If you already have your chart built, you can skip to the next step.
- Open Tableau and connect to the "Sample - Superstore" data source.
- Drag Order Date to the Columns shelf. Right-click the blue
YEAR(Order Date)pill and change it toQUARTER(Order Date). This will give us a bar for each quarter. - Drag Sales to the Rows shelf. Tableau will create a bar chart showing total sales per quarter.
- To create the "stack," drag Region to the Color card under Marks.
You should now have a stacked bar chart showing total sales for each quarter, with the colors representing the different regions. Notice how you can't easily tell which quarter had the highest sales without hovering over each one.
Step 2: Add and Configure the Reference Line
Now, let’s add the totals. Many people first try dragging SUM(Sales) to the Label card, but this adds a label to every segment of the bar, creating a cluttered mess. The trick is to use a reference line instead.
- Navigate to the Analytics pane, located to the right of the Data pane on the left sidebar.
- Under the Custom section, click and drag Reference Line onto your chart.
- As you drag it over, Tableau will give you options to drop it. Hover over the chart canvas until a box appears that says Add a Reference Line. Drop the line onto the Pane option. (Choosing
Paneapplies a separate line and calculation to each bar in the view, which is what we need.Tablewould apply one line across the entire chart.Cellwould apply it to each colored segment.) - A configuration box will pop up. This is where you'll set up your total label.
- Click OK.
Voila! You should now see a clean total neatly positioned at the top of each stacked bar. The final chart elegantly communicates both the components and the grand total for each quarter.
Method 2: The Flexible Way Using a Dual-Axis Chart
The reference line method is fast and effective, but it offers limited options for label formatting. If you want more control over the label's position, font, or color, creating a dual-axis chart is a fantastic alternative. It’s a bit more involved, but it unlocks complete formatting freedom.
Step 1: Create a Second Axis for the Labels
Starting with the same basic stacked bar chart from above:
- Drag the Sales pill from the Measures pane and drop it onto the Rows shelf again, right next to the existing
SUM(Sales)pill. This will create a duplicate of your stacked bar chart. - Now, look at your Marks cards. You should see three:
All,SUM(Sales), andSUM(Sales) (2). We will be working with the second sales cardSUM(Sales) (2). - On the SUM(Sales) (2) Marks card, click the chart type dropdown and change it from Automatic (Bar) to Gantt Bar. The second chart will transform into thin lines.
Step 2: Combine Charts and Add Labels
Now, let's merge these two charts and turn our hidden Gantt Bar marks into labels.
- On the Rows shelf, right-click the second
SUM(Sales)pill and select Dual Axis from the menu. This will overlay the Gantt Bar chart on top of your stacked bars. - Next, we need the axes to match. Right-click the right-side axis (for the Gantt marks) and select Synchronize Axis.
- Now, back on the SUM(Sales) (2) Marks card, drag the Sales measure onto the Label card. Totals will now appear on your chart.
- Finally, to make the Gantt marks invisible, go to the Color card on the
SUM(Sales) (2)Marks shelf and drag the opacity slider all the way down to 0%. The floating lines will disappear, leaving only the labels. - For a final cleanup step, right-click the right-side axis again and uncheck Show Header to hide the redundant axis.
You’ve achieved the same result as the reference line method, but now your labels are completely independent. You can format the font, size, and color of just the totals using the Label card on the SUM(Sales) (2) marks, without affecting any other part of your chart.
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.
Fine-Tuning Your Chart
Whether you used a reference line or a dual-axis, a few final formatting touches can take your chart from good to great.
- Number Formatting: Make your totals easy to read. Right-click the
SUM(Sales)measure in the Data pane, go to Default Properties -> Number Format…, and set it to Currency (Custom) with zero decimals. This will apply a clean "$467K" format chart-wide. - Label Readability: If your total labels are feeling a bit cramped against the top of the bars, you can give them some more distance. With the dual-axis method, you have fine-grained control over alignment in the Label card options. For reference lines, formatting your labels 'above' the line will also give some more room.
- Be Mindful of Clutter: You can have both segment labels and total labels, but it rarely works well. Unless absolutely necessary, favor showing either one or the other - and the total label adds more context in most use cases. The main goal is always clarity.
Final Thoughts
Adding total labels to stacked bar charts in Tableau is a fundamental skill that significantly boosts the clarity of your data storytelling. Both the Reference Line method and the Dual-Axis approach are excellent for achieving this, offering a trade-off between speed and customization so you can use either one depending on your situation.
Having to learn these multi-step processes for common charting tasks is exactly why we built Graphed. We believe you should be able to get answers from your data without hunting through configuration menus and formatting panes. We made things simple so instead of clicking, dragging, and formatting, you can just ask a question in plain English. With our tool, you would simply type, "Show total sales by quarter and region as a stacked bar chart and display the totals on top of each bar" and the right chart is instantly created for you, connected to your live data.
Related Articles
Facebook Ads for Carpet Cleaners: The Complete 2026 Strategy Guide
Learn how to run Facebook ads for carpet cleaning businesses in 2026. Get proven strategies for targeting, creative formats, retargeting, and budget that actually convert.
Facebook Ads For Personal Trainers: The Complete 2026 Strategy Guide
Learn how to effectively use Facebook ads for personal trainers in 2026. This comprehensive guide covers targeting strategies, ad creative, budgeting, and optimization techniques to help you grow your training business.
Facebook Ads for HVAC Companies: The Complete 2026 Strategy Guide
Learn how to run high-converting Facebook ads for HVAC companies in 2026. This guide covers targeting, creative strategies, and proven campaigns that drive real leads.