How to Stack Bars in Tableau
Stacked bar charts are one of the most effective ways to show not just a total, but how different pieces contribute to that whole. Mastering them in Tableau allows you to tell a richer story with your data, moving beyond simple comparisons to detailed breakdowns. This guide will walk you through creating both standard and 100% stacked bar charts and provide practical tips to make them easy to read.
What is a Stacked Bar Chart?
Imagine a regular bar chart showing total sales for different regions. Now, imagine each of those bars is segmented by color, with each color representing a different product category. That's a stacked bar chart. It lets your audience see two things at once:
- The total value for each primary category (the full length of the bar).
- The contribution of each sub-category to that total (the size of each colored segment).
This "part-to-whole" relationship is perfect for answering questions like, "What were our total sales per quarter, and which product lines drove those sales?" or "How many website visits did each marketing channel generate, and what was the breakdown between new vs. returning users?"
Creating Your First Stacked Bar Chart In Tableau
The best way to learn is by doing. We’ll use Tableau’s familiar “Sample - Superstore” dataset to build a chart showing sales by region, stacked by ship mode. If you're a Tableau user, you likely have this dataset available in your "My Tableau Repository" folder.
Step 1: Build the Basic Bar Chart
First, we need a standard bar chart before we can stack anything. This will be our foundation.
- Connect to the Sample - Superstore data source.
- Drag the Sales measure onto the Rows shelf. Tableau will automatically aggregate this as
SUM(Sales). A single vertical bar will appear. - Drag the Region dimension onto the Columns shelf.
At this point, you'll have a simple bar chart showing the total sales for each of the four regions. Now for the fun part.
Step 2: Add the Stacking Dimension
This is where the magic happens. To "stack" the bars, you simply need to tell Tableau how you want to segment them. You do this by using the Color property on the Marks card.
- Locate the Ship Mode dimension in your data pane on the left.
- Click and drag Ship Mode directly onto the Color box inside the Marks card.
Instantly, Tableau redraws the bars. Each region's total sales bar is now divided into colored segments representing "First Class," "Same Day," "Second Class," and "Standard Class." Tableau automatically adds a color legend to the right. That’s it! You've successfully created a stacked bar chart.
Level Up: Creating a 100% Stacked Bar Chart
A standard stacked bar chart is great for seeing absolute contribution, but what if you want to see the relative contribution? For example, is "First Class" shipping consistently 10% of sales across all regions, or does it make up a larger percentage in some regions than others?
This is where a 100% stacked bar chart comes in. Instead of showing actual sales values, it shows the percentage contribution of each segment, with every bar totaling 100%.
Step 1: Apply a Quick Table Calculation
Starting from the stacked bar chart we just created:
- Right-click on the
SUM(Sales)pill on the Rows shelf. - In the context menu, hover over Quick Table Calculation.
- Select Percent of Total.
Your chart will change. The Y-axis now shows percentages, and the bars have re-sized. But they probably don't all reach 100%. That’s because, by default, Tableau is calculating the percent of the grand total. We need to tell it to calculate the percent within each bar (each Region).
Step 2: Adjust the Calculation Method
Tableau needs to know how to compute the percentage. We want it to be computed for each Ship Mode "down" the stack for each Region.
- Again, right-click the
SUM(Sales)pill on the Rows shelf. - Select Edit Table Calculation.
- A dialog box will appear. Under "Compute Using," select Table (down).
Pro Tip: Alternatively, you can use "Specific Dimensions" and ensure only "Ship Mode" is checked. This tells Tableau to calculate the percentage contribution of each Ship Mode within the pane defined by "Region."
Now, each bar extends to the 100% mark. You can clearly compare the proportional mix of shipping modes across regions, regardless of which region had the highest total sales.
Best Practices for Clearer Stacked Bar Charts
Creating the chart is only half the battle. Making it easy for your audience to understand is just as important. Here are a few tips to improve readability.
Sort Your Data Intentionally
By default, segments are sorted alphabetically (First Class, Same Day, etc.). This can make comparisons difficult. A more logical order might be based on segment size. Right-click the "Ship Mode" dimension in the legend and choose "Sort." You can sort it manually or by a field (like sorting descending by Sales) to place the largest segment at the bottom, which creates a more stable baseline.
Use Color Thoughtfully
While Tableau’s default colors work, they aren't always a great choice for telling a story.
- Limit Your Segments: Stacked bar charts become unreadable with more than five or six segments. Too many colors create a "rainbow effect" that's hard to interpret.
- Use Intuitive Colors: Use brand colors or colors that have an inherent meaning. For example, if you were stacking survey responses ("Very Satisfied" to "Very Dissatisfied"), you could use a green-to-red diverging palette. Double-click the color legend to edit colors.
Add Clear Labels
Constantly forcing a viewer to reference the legend and mentally estimate values is not ideal. Add labels directly to the chart.
- From the data pane, drag Sales onto the Label box on the Marks card. This will add the sales value to each segment.
- For extra clarity, you can also drag Ship Mode to the Label box. Now each segment is labeled by both its name and its value.
This makes the chart easier to read at a glance without relying on tooltips.
When NOT to Use a Stacked Bar Chart
This visualization is powerful, but not perfect for every situation. Avoid using a stacked bar chart when:
- Comparing segments against each other: It's easy to compare the bottom segments (e.g., "Standard Class") because they share a common baseline at zero. It's almost impossible to accurately compare the sizes of the segments in the middle because their starting points vary. If that comparison is your main goal, a grouped bar chart might be better.
- You have negative numbers: Showing positive and negative values in a stacked bar chart can be confusing and misleading.
- Precision is critical: A table is often better when users need to see precise numbers. A stacked bar chart is better for showing trends and proportions.
Final Thoughts
You've now learned how to create, customize, and thoughtfully apply stacked bar charts in Tableau. By transforming a simple bar chart into a stacked one, you unlock a deeper layer of insight, and by converting it to a 100% chart, you shift the focus to relative proportions. These are essential techniques for anyone looking to build more informative dashboards.
While mastering a tool like Tableau is an incredibly valuable skill, we know that marketers and sales leaders sometimes need to create dashboards in seconds, not hours. For those situations, we built Graphed to handle the heavy lifting. You can connect all your scattered data sources (like Google Analytics, Salesforce, and Facebook Ads) and then simply ask in plain English - "show me my Shopify revenue stacked by discount code" - and get back a real-time chart, no dragging and dropping required.
Related Articles
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.
How to Create a Photo Album in Meta Business Suite
How to create a photo album in Meta Business Suite — step-by-step guide to organizing Facebook and Instagram photos into albums for your business page.