An on-line library for creating different chart types in Tableau

Stacked Bar Chart

Tableau Canvas Layout:

A typical bar chart will have one or more dimensions on the Rows and a Measure on the Columns for horizonal bar chart, or vice-versa for a vertical bar chart.

Data Set: Sample Superstore Dataset

Building a Stacked Bar Chart

Using the Superstore data:

     Double-click Sales. This will put Sales on the Rows (alternatively move Sales to Rows or to the y-axis).
     Double-click Category. This will put Category on Columns (alternatively move Category to Columns or the x-axis).
     Double-click sub-Category. This will put sub-Category on Columns (alternatively move sub-Category to Columns or the x-axis).
     Move Region to Color.

Click the button on the top menu to swap Rows and Columns. This will rotate the chart, moving all of the pills on Rows to Columns and all the pills from Columns to Rows.

Notice the Marks Card is set to Automatic in the dropdown box. Tableau will automatically create a bar chart based on this data. You can select Bar in the dropdown menu, but in this case it doesn't matter. You should now have a vertical stacked bar chart similar to the image below.

You can use any Dimension on Color. For example, I used a stacked bar chart to show open vs. closed complaints on the Complaints Dashboard in Chapter 20 from the Big Book of Dashboards. This is a good example of where a stacked bar chart works really well.

However, the example we built using Region on Color is not a good view of this data, because stacking a bar chart with too many slices and colors makes the comparisons very hard. So instead, let's focus on a single Region.

Hold down the Control key and multi-select Central, East and South in the Color Legend. In the pop-up window, select the paperclip. This will create a custom group and will group those three regions together.

Double-click on the color legend color for the new group that you created for these three regions and change the color of this group to light gray. When you unselect the colors in the color legend you should now a stacked bar chart that looks like the image below.

If you need the stacked bar chart to be vertical instead of horizontal then simply click the button on the menu to swap Rows and Columns back. This will rotate the chart, moving all of the pills on Rows to Columns and all the pills from Columns to Rows.

The order of the stacked bar chart colors is determined by the order of the color legend. Simple drag the colors in the color legend up or down to reorder the colors in the stacked bar chart.

Related Blog Posts:

How to take the “screaming cats” out of stacked bar and area charts by Steve Wexler

Return to the chart gallery