In this blog, I want to discuss how to create a Stacked bar chart with two measures and totals of the stack at the end. In my earlier blog, I showed how to display total on a stacked bar chart in Tableau. That stacked bar was created using only one measure and was relatively easy.

Creating Stacked Bar chart with two Measures

First we will create a stacked bar chart with two measures and then we will apply Totals to it. You can use Tableau Public or desktop for this exercise. 

  1. Connect to Sample-Super store.xls data set. Use the Orders table.
  2. From the data pane, place a dimension such as Order Date on the Rows. Place Measure Names on the Color.
  3. Right-click on the Measure Names on the Color and select Filter. On the Filter screen, select the measures which you want to include in your stack chart. I will choose Profit and Quantity.
Filter the Measure Names
Filter the Measure Names

4. From the data pane/Measures, place Measure Values on the Columns. This will create your Stack bar chart. 

5. Place Measure Values on the Label card. This will show you the numbers on the bar.

Stack chart with 2 measures
Stack chart with two measures

Creating Totals on the Stacked bar chart with two measures

Now we would like to add totals at the end of the bar so that the numbers of Profit and Quantity can add up to Totals.

  1. Create a calculated field. Navigate to menu Analysis and select Create Calculated Field. Name the calculated field as Total and use the following calculation:   

                                        Profit + Quantity 

2. Drop this Total calculated field next to Measure Values on Columns. This will show you two bar charts.

3. On Columns, right-click on Sum(Total) and select Dual Axis. Right-click on the axis and choose “Synchronize axis”.

4. Click on the Sum(Total) on the Columns again. Navigate to Marks and change the shape of Sum(Total) to circle.

Changing display to Circle
Changing the display of the second measure to Circle

This will give you a Stacked Bar chart with Totals at the end, depicted with a circle.

Stacked Bar Chart with multiple measures and Totals
Stacked Bar Chart with two measures and Totals


About the Author

Chandraish Sinha has  20+ years of experience in Information Technology. He is an accomplished author and has published 11 books covering Business Intelligence related topics such as, Tableau,Power BI, and Qlik. Checkout his Amazon Author profile.

His latest book Excel Basics to Advanced covers all the aspects of MS Excel and provides exercises for self-learning.

Similarly, his recent book, Dashboarding with Tableau, covers all the features in Tableau and includes exercises for self-learning.

He has implemented IT solutions in different domains viz. Pharmaceutical, Healthcare, Telecom, Financial and Retail.

He blogs regularly on various IT topics. Check them out in the links given below: 

Blogs

Learn Tableau

Learn All Bi

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.