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
- 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.
- Right click on the axis and select add reference line, band, or box.
- Adjust the reference line options to match the image on the left and select OK
- Right click on the reference line (text) to format.
Dual Axis
Reference for steps 3 and 6 |
- 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.
- Add the measure to columns again (sales).
- Using the multiple marks card select the first measure and Remove the color dimension (region).
- Go up to columns and right click on the second measure and select dual axis.
- Using the marks card adjust the marks so they are set to bar graph.
- Right click on the top axis and select synchronize axis.
- Add labels to both marks and format.
Thanks, that really worked.
ReplyDeleteThanks - 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.)
ReplyDeleteVery nice article, I enjoyed reading your post, very nice share, I want to twit this to my followers. Thanks!. Bridal Shop Saudi Arabia
ReplyDelete