How to Get Total in Tableau
Trying to show totals in a Tableau table or chart can feel like one of those tasks that should be simple but ends up being surprisingly tricky. You just want to see the grand total at the bottom of a column, but the options aren’t always where you expect them. This guide will walk you through everything you need to know about adding totals and subtotals, from the easy one-click method to custom totals for when things get complicated.
The Easiest Way: Using Tableau’s Analysis Menu
For most basic tables and charts, adding totals is a breeze. Tableau has a dedicated menu just for this purpose, which is your first stop for getting totals to appear on your viz.
Let's say you have a simple text table showing Sales by Region and Category, using Tableau's sample Superstore dataset. It looks something like this:
Sales by Region and Category (No Totals)
Central | Bookcases | $143K Central | Chairs | $118K East | Bookcases | $150K East | Chairs | $205K ...
Right now, you have the detailed numbers, but no totals for each region or an overall grand total. Here’s how you add them in just a few clicks:
- Navigate to the top menu bar in your Tableau worksheet.
- Click on Analysis.
- Hover over Totals.
- A sub-menu will appear with several options for showing totals.
Row vs. Column Grand Totals
The two most common options you’ll use are Show Row Grand Totals and Show Column Grand Totals.
- Show Row Grand Totals: This adds a new column on the right side of your table that sums up all the measure values across each row. This is useful for seeing the total for each Category across all Regions.
- Show Column Grand Totals: This adds a new row at the bottom of your table that sums up all the measure values in each column. This is what you’d use to see the total sales for each Region and an overall grand total for the entire table.
For our example, let's select Show Column Grand Totals. Your table will instantly update with a new "Grand Total" row at the bottom, giving you the total sales for the Central, East, South, and West regions, plus a final total for the whole business.
That's it! For 80% of situations, this is all you'll need.
Adding Subtotals for More Detail
Grand totals are a great start, but what if your table has more than one dimension? For instance, what if you add Sub-Category to the rows shelf after Category? Now you have a hierarchy, and you might want to see the total sales for each Category (like Office Supplies or Furniture) before you see the final grand total.
This is where subtotals come in. Luckily, they live in the same menu.
- Go back to Analysis > Totals.
- Click Add All Subtotals.
Tableau will automatically add a total line for each of your primary dimensions. Now, you’ll see the total for Furniture, the total for Office Supplies, and the total for Technology, giving you a much clearer picture of your data's structure without having to export it and mess around in Excel.
You can remove them just as easily by going to the same menu and clicking Remove All Subtotals.
Customizing Your Totals
Once you have totals and subtotals on your view, you have some control over how they look and what they calculate. Maybe "Grand Total" is too generic for your dashboard, or maybe you need to show an average instead of a sum.
Editing the Total Label
Don’t like the default “Grand Total” label? You can change it.
- Right-click on the "Grand Total" label in your table.
- Select Format... from the dropdown menu.
- The Format pane will open on the left side of your screen. Under the "Header" section, look for the Label field in the "Grand Total" area.
- Simply type your desired name, like “Total Company Sales,” and hit Enter. The label will update instantly.
Changing the Aggregation of Your Total
This is one of the most powerful and often overlooked features of Tableau totals. By default, Tableau usually sums the values to create a total. But what if you’re looking at a measure like Average Discount? Summing up the averages for each category won't give you the correct overall average discount for the company.
Tableau understands this. Instead of just summing the numbers you see on the screen, Tableau’s totals are a separate calculation performed over the underlying data at a different level of detail. And you can control how that calculation works.
Here’s how to change it:
- Go to Analysis > Totals > Total All Using.
- By default, it’s set to Automatic, which typically defaults to a sum for numeric fields.
- You can change this to Sum, Average, Minimum, or Maximum.
For our Average Discount example, you would select Average. Now, the grand total row won’t show the sum of the percentages, but the true average discount across all transactions in your dataset. This ability to change the aggregation is what makes Tableau’s totals far more reliable than just adding a SUM() row in a spreadsheet.
When Totals Don't Work: Troubleshooting Common Problems
Sometimes, you follow the steps and your totals are either missing, greyed out, or just plain wrong. This usually happens when you start using more advanced calculations or data structures. Here are some of the most common reasons why and how to fix them.
Problem 1: Totals with Table Calculations
If you're using a table calculation, like Percent of Total, your grand total might show 100%. While technically correct, it's not always useful. This happens because the total is also a table calculation, being computed over the entire table. In these cases, the default totals are behaving as designed, but you might need a different approach. Often, the solution involves Level of Detail (LOD) expressions to pre-calculate values rather than relying on a table calculation that depends on the structure of the viz itself.
Problem 2: Totals on measures with complex aggregations (like COUNTD)
Working with distinct counts (COUNTD) can also cause confusion. If you have a list of customers by region and you want a distinct count of customers, the grand total is not the sum of the rows. For example:
- East Region: 50 Customers
- West Region: 60 Customers
The Grand Total may be 100 customers, not 110, because 10 customers made purchases in both the East and West regions. Again, Tableau is not just summing what it sees, it’s recalculating COUNTD(Customer Name) over the entire dataset for the Grand Total row. This is actually a feature, not a bug, as it gives you the correct, de-duplicated total. It’s important to understand this behavior to trust your numbers.
Problem 3: The Need for Custom Totals
What if the Analysis > Totals menu doesn't give you what you need? For example, you want the total row to calculate an overall average, while the detail rows show a sum. The built-in menus will force the calculation to be the same for all levels.
For these situations, you need to step outside the standard menu and build your own total logic using a calculated field. The magic trick here is a table calculation function called SIZE().
The SIZE() function returns the number of rows in the current partition. In a detailed row of your table, SIZE() will be high. But in the Grand Total row, the partition size is just 1. We can use this to create custom logic:
IF SIZE() = 1 THEN
// This is the Grand Total row. Put your total logic here.
AVG([Sales])
ELSE
// These are the detail rows. Put your normal logic here.
SUM([Sales])
ENDLet's break down how this works:
- Create a new calculated field. Let’s call it "Custom Sales Total."
- Enter the formula above. This calculation tells Tableau: "If you are in the grand total row (
SIZE()equals 1), compute the average of sales. For every other row in the table, compute the sum of sales." - Remove the original
SUM(Sales)pill from your Measures shelf. - Drag your new "Custom Sales Total" calculated field to the Text or Measures shelf.
- Go to Analysis > Totals > Show Column Grand Totals just like before.
Now, your table will display the sum of sales for each category, but the grand total at the bottom will show the average sale amount across the entire dataset. This IF SIZE() = 1 THEN ... pattern is an incredibly flexible technique for any time you need the total row to behave differently from the rest of your viz.
Final Thoughts
Mastering totals in Tableau is about knowing where to find the simple menu-based options and understanding when you need to take manual control. For most tables, heading to the Analysis menu is all you'll need to show sums and averages for your columns and rows. For more complex vizzes involving tricky aggregations or table calculations, building your own logic with functions like SIZE() gives you the flexibility to display exactly what you need.
Getting your data presented correctly in tools like Tableau is a critical first step, but it often involves clicking through menus, writing custom formulas, and fighting with formatting. We believe a lot of this work can be automated. With Graphed, you connect your data sources and simply ask for what you want in plain English. Instead of building a table and then hunting for the totals menu, you can ask, "Show me a table of total sales by region and category for last year," and get a live, interactive visualization with the correct totals built-in, seconds later.
Related Articles
How to Enable Data Analysis in Excel
Enable Excel's hidden data analysis tools with our step-by-step guide. Uncover trends, make forecasts, and turn raw numbers into actionable insights today!
What SEO Tools Work with Google Analytics?
Discover which SEO tools integrate seamlessly with Google Analytics to provide a comprehensive view of your site's performance. Optimize your SEO strategy now!
Looker Studio vs Metabase: Which BI Tool Actually Fits Your Team?
Looker Studio and Metabase both help you turn raw data into dashboards, but they take completely different approaches. This guide breaks down where each tool fits, what they are good at, and which one matches your actual workflow.