<< Back

Show me How: Stacked Bars

Show Me How: Stacked Bars

Stacked bar charts can be used to indicate relationships in your data. They have the benefit of being easy to understand, but are able to display an extra level of detail than a simple bar chart.

Stacked bars allow you to see both the aggregation of the members in the group, and the total. Their main downfall is it can become difficult to compare the size of the individual members (in which case a side-by-side bar may be more useful). One thing to note is that a stacked bar implies a part to whole relationship – so as with pie charts make sure your groupings make sense! As with pie charts you should also be careful not to try and represent too many categories per bar, or you may find it harder to spot patterns in your data.


Where to start

To make a stacked bar chart you will need two dimensions and one measure, preferably ones that imply a grouping. In this example I have data from the 2012 Olympics.

stacked bar without label

In the chart I’m showing per sport, per gender, the number of gold medals won. Here’s how it’s made.

Firstly I click and drag the Sport field from the dimensions pane to the rows shelf. Then I take the Gold field from measures and place it on the columns shelf. This creates a bar chart. All that’s left is to take Gender from dimensions and drag that on to colour on the marks card. There’s also a handy video at the end of the post so you can follow along step by step if needed.


Labelling stacked bars

marks card labels

Stacked bar charts can be a little tricky to label. Let’s take our Gold field again from our Measures (or if you’re feeling clever, hold ctrl and click Gold on the columns shelf – this will create a copy that you can then use elsewhere on the view) and place it on text on the marks card.

stacked bar with label

This works if we want to label the individual ‘stacks’. But what about if we want to label the end of the bar with the total for all the parts? Here’s where we have to get a bit clever with reference lines.

Right-click the Gold axis and select “Add reference line, band or box”. In the dialogue window that opens apply the following settings:

reference line

Here’s the result:

stacked bar with axis label

The axis lines have been added per cell to sum the number of Golds for each stack of our bars. As we chose to only display the label and not the line the reference line appears to only label our bars with the total number of Golds for each. Clever stuff.

You can now format the reference lines by right-clicking on them. I like to change the alignment of the font to make them more central to the bars.

My final tip is when you’re placing your lovely stacked bar charts on a dashboard is to remember to include the colour legend. This lets your end user see what the different colour segments are!

Here’s the step-by-step video and workbook for you to download and work through.

The Information Lab: Show me How: Stacked Bars

Download the workbook


Show Me How Series

You can find links to the other posts in the series on our Show Me How Index Page.

Emma Whyte

London, UK

2 thoughts on “Show me How: Stacked Bars

  1. I came across this situation today and came up with a solution that does not display the total for bars that have a single category.

    I created a duplicate measure that checks for the count of the categories and called it ReportRevenueDualLabel:

    If COUNT([ReportRevenueCategory]) >1 THEN



    This worked great on a standard dual axis bar chart, but not so well on a running sum bar chart, because you need the values from the bars with single categories in the running sum. So I created another measure called

    Results are computed along Table(across)
    If RUNNING_SUM(SUM([ReportRevenue])) != SUM([ReportRevenue]) THEN



    In each case I used a dual axis chart and made the dual axis a Text Mark. To create some space at the top of the bar, so the label was not touching the top of the bar, I added 2 carriage returns in the Edit Label window under the measure.

Leave a Reply

Your email address will not be published. Required fields are marked *