how to add subtotals in tableau

Mastering Tableau: Add Subtotals Effortlessly

By Emily Taylor
AD

In the dynamic world of data visualization, Tableau has emerged as a powerful tool for turning raw data into meaningful insights. One of the most sought-after features of Tableau is its ability to add subtotals, allowing users to summarize and analyze data more effectively. In this comprehensive guide, we'll walk you through the process of adding subtotals in Tableau, complete with tips, tricks, and best practices to enhance your data exploration experience.

Before we dive in, ensure you have a firm understanding of your data and what you aim to achieve with subtotals. They are an invaluable tool for condensation, comparison, and tracking changes over time, but are only as effective as the strategy behind their application.

Understanding Subtotals in Tableau

Tableau's subtotal functionality enables you to create summaries of data at a particular dimension level. For instance, you might want to subtotal sales by month to track seasonal trends, or by region to compare performance across different geographical areas.

AD
How to Insert Subtotals in Excel: 7 Unique Methods - ExcelDemy
How to Insert Subtotals in Excel: 7 Unique Methods - ExcelDemy
Teach Yourself Tableau With These 6 Resources (Free and Paid Options)
Teach Yourself Tableau With These 6 Resources (Free and Paid Options)
Best Practices for Creating Calculations in Tableau
Best Practices for Creating Calculations in Tableau

Subtotals can be aggregated using various functions, such as Sum, Average, Count, and Median, among others. They can also be calculated fields, offering broad flexibility in customization.

Types of Subtotals in Tableau

Quick Table Calculation: This type allows you to quickly create a subtotal using a predefined calculation. It's quick, easy, and perfectly suitable for most basic needs. Available options range from sums and averages to counts and medians.

How to Sort Subtotals in Excel (with Quick Steps) - ExcelDemy
How to Sort Subtotals in Excel (with Quick Steps) - ExcelDemy
Excel SUBTOTAL Function – Calculate Filtered Data Easily
Excel SUBTOTAL Function – Calculate Filtered Data Easily
Tableau Tutorial for beginners
Tableau Tutorial for beginners

Table Calculation: For more complex requirements, you can create custom table calculations. This allows for greater control and customization, with numerous functions and options at your disposal. These include FIXED, which restricts the calculation to a specific dimension level, and EXCLUDE, which ignores specified values in the calculation.

Step-by-Step Guide to Adding Subtotals in Tableau

To begin, let's explore how to add a quick table calculation for subtotals. Using the 'Sales' example from the Sample - Superstore dataset, we'll create a subtotal for 'Sales' by 'Category'.

AD

1. Drag and drop: Drag your 'Sales' measure to the 'Text' shelf (or the bar chart axis).

Abdul Wahab Junaid is Offensive Security Researcher | Quantum Cryptography Analyst
Abdul Wahab Junaid is Offensive Security Researcher | Quantum Cryptography Analyst
How to Subtotal Multiple Columns in Excel Pivot Table (with Easy Steps) - ExcelDemy
How to Subtotal Multiple Columns in Excel Pivot Table (with Easy Steps) - ExcelDemy
Excel VBA Subtotal On A Dynamic Range
Excel VBA Subtotal On A Dynamic Range
Save time with these 10 Tableau shortcuts
Save time with these 10 Tableau shortcuts
subtotal 9 sum visible cells only in the table below it is an example
subtotal 9 sum visible cells only in the table below it is an example
Analysing the Superstore Sales Dataset Using Tableau | Tableau Project Help, Tableau Assignment Help
Analysing the Superstore Sales Dataset Using Tableau | Tableau Project Help, Tableau Assignment Help

2. Context menu: Right-click on the 'Sales' pill on the Text shelf and select 'Quick Table Calculation'.

3. Select calculation: Choose 'running total' or 'sum' for a straightforward total. You can also choose 'subtotal', which includes the total for the current value and all subsequent values in the dimension.

AD

4. Apply and adjust: Click 'OK' to apply the calculation. The subtotal will appear below each category. If needed, adjust the format of the subtotal for better readability.

How to Make Subtotal and Grand Total in Excel (4 Methods) - ExcelDemy
How to Make Subtotal and Grand Total in Excel (4 Methods) - ExcelDemy
8 Best Tableau Courses Online- Find the Best One For You!
8 Best Tableau Courses Online- Find the Best One For You!
Easy Steps to Create a Dashboard in Tableau
Easy Steps to Create a Dashboard in Tableau

Customizing Subtotals in Tableau

Beyond the simplest use cases, subtotals allow for a wide array of customizations. Here, we'll explore a few advanced techniques to help you get the most out of this powerful feature.

Using Table Calculations for Subtotals

For more complex use cases, you may need to create a custom table calculation. Here's how you can create one:

AD

1. Create calculated field: Right-click in the view and select 'Create Calculated Field'.

2. Define calculation: Enter the calculation formula. For example, to add a running total, use: {FIXED [Category]: SUM([Sales])}

3. Apply calculation: Drag the new field to the view. Right-click and select 'Default Properties' to adjust its appearance and label.

Forcing Pagination and Removing Blank Spaces in Subtotals

Sometimes, subtotals may include blank spaces when there's no data. You can remove these by setting the 'No Data' text to be null. Similarly, you can force pagination to control how subtotals appear in your view.

To do this, right-click on the subtotal text mark, select 'Format', then adjust the fields under 'General' and 'Number' as needed.

Adding subtotals in Tableau is an incredibly useful skill to have in your data exploration toolkit. Whether you're a seasoned user or just getting started, understanding how to leverage subtotals can unlock new insights and enhance your analysis. So, go ahead – give it a try, experiment, and see what you can discover in your data!

AD