How to Create Totals in Tableau

Aggregations or Totals are important in any Visualization application. In Tableau, it is easy to display totals in your charts. There are many variations to creating Totals and Subtotals. In this article, we will discuss how to create Totals in Tableau.

How to Create Totals in Tableau

In Tableau, Totals can be displayed by using the options available in the Analysis menu. We can display Grand Totals in Rows and columns. Subtotals can also be displayed for various dimensions.

  1. To explain this concept, I will connect to Tableau provided Sample-Superstore.xls. If you are new to Tableau, learn how to connect to excel datasource and create a chart. 
  2. Create a Table visual by using dimensions – State and City on the Rows and a measure – Sales on the Text (under Marks). For display purposes, I will filter the data for the States – Maine and Vermont, as these states have less number of Cities.  
  3. To add Sub-totals for States and Grand totals for both the States, navigate to Analysis menu and select Totals.
Add Totals and Subtotals in visualizations
Totals option under Analysis menu
  1. We will get a table with Grand Total and Sub-totals for each state.
Grand Total for States

Creating Subtotals for different dimension levels

  1. Now in the above table, add Category, Sub-Category and Segment, next to City on Rows. We will be creating Sub-totals for each of these dimensions.
  2. To add Subtotals for each dimension level, navigate to Analysis menu and select Add All Subtotals. We will get the Subtotals at each level, and a Grand Total.
Creating subtotals for different dimensions
Subtotals for different dimensions and Grand Total
  1. Notice that at all the levels (except the Grand Total) Totals are displayed with the text “Total”, it can make your table confusing. Change the text(from Total to subtotal) from the formatting option, right-click on the Totals text (at any level) and select Format.

Removing the Subtotals from a dimension level

In some cases, you may want to remove the Subtotals from a specific dimension. We can always navigate to the Analysis menu and from the Totals select Remove All Subtotals. But this will remove all of the Subtotals from the table. If you want to remove subtotals at a certain level, say for e.g. from the Sub-Category level, then this solution will not work.

To remove a subtotal at a specific dimension level, on the Rows, right-click on that specific dimension and uncheck subtotals.

Option to remove the subtotals from a specific dimension
Option to remove the subtotal

Note when Totals are used in the above fashion, Tableau is calculating them automatically. If you wish to control it or want to calculate it in a different way, then navigate to Analysis menu and from the Totals select Total All Using.

Controlling how totals are calculated in Tableau
Control how Totals are calculated

If you follow the above mentioned steps you can create effective Totals and Sub-totals based on visualization requirements.


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.