This blog is actually more of a self reference on how to make a stacked bar chart in Tableau. For some reason, despite how simple they look, stacked bar charts have always given me strife. Whenever I need to make one, for the life of me I can never remember how. That changes today!

A stacked bar chart is basically a bar chart split into sections. If you want to split one bar into many, you first have to ask? Does my data support that?

Lets try and make some stacked bar charts with everyones favourite dataset… Superstore!

TYPE 1: Simple Stacked Bar Chart

Is the measure aggregated (a combination of different categories/segments/dimensions)? If so, then your aggregate can be split into whatever dimensions are aggregated in the data.

This is more a question of the granularity of your data, since aggregate measures change the level of granularity.

  1. Drag Sales to a Colum or Row to get an aggregation of Sales (SUM, AVG, COUNT, etc.). The aggregation means that you’re actually getting result of a bunch of rows which may or may not be part of a specific dimension.
  2. Identify at what level you want your bar to be split into (the dimension).
  3. Drag that relevant dimension to DETAILS on the Marks card. This changes the level of detail of your measure to the level of that dimension. If instead you dragged it to rows/columns, each row/column would be a different segment of that dimension.
  4. Pro tip: Distinguish the different stacked bars by dragging that Dimension to COLOUR.

TYPE 2: 100% Stacked Bar Chart

To make a 100% stacked bar chart, we need the each aggregation to be relative to the overall total.  We could make a Calculated Field containing:

SUM([Measure]) / TOTAL(SUM([Measure]))

This calculation, if a dimension is in the DETAILS pill, will calculate the sum of sales for each dimension divided by the sum of sales across all dimensions (changing the units to a percentage of the total).

OR we could just do a quick table calc…

Right Click > Quick Table Calculation > Percent of Total

TYPE 3: Set Stacked Bar Chart

You can also create stacked bar charts with Sets.

If you add a Dimension to a set, and select the relevant members of the set, you can segment whatever aggregated measure you want by the Set (if they’re somehow related). You have two options:

  • In/Out of Set – separates the bars as either being in or out of the set that you created

  • Members of Set – only shows you the members of the set

Similarly to the other bar charts, if you add the Set to a detail or colour pill, then it will segment your data appropriately.

TYPE 4: The Cheat Method

Just highlight both a Measure and a Dimension, click on ‘Show Me’ on the right side of the window, and select Stacked bar chart.

Well there you go, you’ve done it. You made a stacked bar chart!

Use your skills wisely.









Kevin Prescilla
Author: Kevin Prescilla

As a late-stage PhD candidate, Kevin’s appreciation for data analytics grew during his studies into poultry nutrition, or as he calls it, “chickens”. It was this appreciation which spurred his decision to change career paths and ultimately led him to apply to the Data School. In his spare time he enjoys powerlifting – ever challenging himself to beat his last max weight - as well as all kinds of gaming, from board to PC. If Kevin could go anywhere in the world, where would it be and why? Well, the answer is Antarctica, as he is fascinated with how people can live and survive down there (although some might argue because it’s the furthest place you can go on Earth from a chicken).