ADDING TOTALS TO STACKED BAR GRAPHS


Stacked bars can be really useful.  In this example we are able to compare the total number and region breakdown of sales across product sub-categories as well as sales within each product sub-category.  When you make a stacked bar in Tableau it automatically labels each color category and you lose the total amount that the bar adds up to.  This post will provide quick tips to add totals to your stacked bar graphs.  


In this example workbook I have created two ways to add totals.  The first way uses a reference line and the second uses a dual axis.  The reference line can be used when showing 1 or more measures and will probably be easier than using dual axis.  The dual axis can only be used when you are showing 1 measure.  


Reference Line


  1. Create your stacked bars how you normally would.  In this case example I'm showing sales for each Product Sub-Category broken down by region.
  2. Right click on the axis and select add reference line, band, or box.
  3. Adjust the reference line options to match the image on the left and select OK
  4. Right click on the reference line (text) to format.







Dual Axis
Reference for
steps 3 and 6


  1. Create your stacked bars how you normally would.  In this case example I'm showing sales for each Product Sub-Category broken down by region.
  2. Add the measure to columns again (sales).
  3. Using the multiple marks card select the first measure and Remove the color dimension (region).
  4. Go up to columns and right click on the second measure and select dual axis.
  5. Using the marks card adjust the marks so they are set to bar graph.
  6. Right click on the top axis and select synchronize axis.
  7. Add labels to both marks and format.

3 comments:

  1. Thanks - this is great. Any idea how to go about including value as a % of total for the given bar? (I only have two values - true and false and want to show the % of true form the total value.)

    ReplyDelete
  2. Very nice article, I enjoyed reading your post, very nice share, I want to twit this to my followers. Thanks!. Bridal Shop Saudi Arabia

    ReplyDelete