How to Add a Total Row in Tableau

Cody Schneider••7 min read

Adding a total row to your Tableau tables is one of the most common and useful tasks for summarizing data, but it's not always as straightforward as a single click. Depending on what you're trying to calculate, you might need a simple sum, a custom average, or a unique calculation. This guide will walk you through three different methods for adding total rows in Tableau, from the easy built-in feature to more flexible custom solutions.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

The Quickest Method: Using Tableau's Built-in Grand Totals

For most simple tables, Tableau has a built-in feature to add totals and subtotals in just a few clicks. This is the perfect place to start. It works wonders when you need a simple sum, average, or other standard aggregation of your columns and rows.

Let's use an example. Imagine you have a view showing Sales by Category and Sub-Category from a sample dataset.

Step-by-Step Instructions:

  1. Navigate to the top menu and click on Analysis.
  2. In the dropdown menu, hover over Totals.
  3. From the context menu that appears, select Show Row Grand Totals.

That's it! Tableau will instantly add a "Grand Total" row to the bottom of your table, summing up the sales for all categories.

You'll notice other options in the Analysis > Totals menu:

  • Show Column Grand Totals: Adds a total column on the right side of your table. This is useful if you have date parts or other dimensions in your columns.
  • Add All Subtotals: If you have multiple dimensions in your rows (like our Category and Sub-Category example), this will add a subtotal for each primary dimension. In our case, it would add a "Total" line for Furniture, Office Supplies, and Technology.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Changing the Aggregation of the Total

By default, Tableau uses SUM for the grand total. But what if you want to see an average, a minimum, or a maximum instead? You can change this easily.

  1. Right-click on the "Grand Total" header in your table.
  2. In the context menu, you'll see an option like Total using (Sum).
  3. Hover over this option to select a different aggregation, such as Average, Minimum, or Maximum.

This method is fast and efficient for standard summaries. But sometimes, you need more control over what the total row actually calculates.

For More Control: Creating Custom Totals with Calculated Fields

The built-in grand total feature has a key limitation: it recalculates the measure for the entire dataset. For instance, the Grand Total of AVG([Sales]) is the average of all underlying rows of your data source, not the sum or average of the displayed averages in your table rows. This is usually what you want, but not always.

What if you want the "total" row to display something completely different, like the average of the growth percentages in the rows above it? Or perhaps you want rows to show sums but the total row to show an average. In these cases, you need a calculated field.

We can use the SIZE() function to tell Tableau to perform a different calculation for the total row. SIZE() returns the number of rows in the current partition. In a standard detail row, it will be greater than one, but in the Grand Total row, it will always be one.

Example: Displaying Average Sales in the Total Row

Let's say your table shows SUM(Sales) for each Sub-Category, but you want the Grand Total row to show the average of all Sub-Category sales totals, not the grand sum.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Step 1: Create a Calculated Field

  1. Open the calculated field editor by clicking the dropdown arrow in the Data pane and selecting Create Calculated Field.
  2. Name your calculation something descriptive, like "Custom Sales Total".
  3. Enter the following formula:
IF SIZE() = 1 THEN
    WINDOW_AVG(SUM([Sales]))
ELSE
    SUM([Sales])
END
  1. Click OK.

Let's quickly break this down:

  • IF SIZE() = 1 THEN: This checks if the current row is the Grand Total row.
  • WINDOW_AVG(SUM([Sales])): If it is the total row, this table calculation computes the average of the SUM(Sales) values from all the other rows in the view.
  • ELSE SUM([Sales]): If it's a regular data row (not the total), it simply displays the sum of sales for that row's dimension.

Step 2: Add the Calculation to Your View

  1. Drag the original SUM(Sales) pill off your view.
  2. Drag your new Custom Sales Total calculated field onto the Text mark.
  3. Make sure you still have Show Row Grand Totals enabled from the Analysis > Totals menu.

Now, your detail rows still show the sum of sales for each Sub-Category, but the Grand Total row displays the average of those values, giving you a custom summary that the default behavior couldn't achieve.

The Ultimate Flexibility: Building a Total Row with a Second Worksheet

For complete control over calculation, formatting, and layout, the most powerful method is to create the total row as a separate worksheet and combine them on a dashboard. This approach is perfect when you need the total row to have a different background color, a bold font, or a calculation that's completely separate from the structure of your primary table.

Step 1: Create Your Main 'Details' Worksheet

Start by building your primary table. For this example, we'll stick with our Sales by Category and Sub-Category view. Do not add any totals from the Analysis menu.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Step 2: Create the 'Total' Worksheet

  1. Duplicate your main worksheet. Right-click its tab at the bottom and select "Duplicate".
  2. Rename the new sheet something like "Total Row".
  3. On this "Total Row" sheet, remove the lowest level of detail from the Rows shelf. In our example, that means removing the Sub-Category pill. You're left with just Category, which will give you subtotals. If you wanted one single grand total, you would remove all dimensions from the Rows shelf.

Step 3: Combine Them on a Dashboard

  1. Create a new dashboard by clicking the "New Dashboard" icon at the bottom.
  2. From the Objects menu in the bottom-left, drag a Vertical container onto the dashboard canvas. This container will keep our two worksheets neatly stacked.
  3. Now, drag your main 'details' worksheet into the vertical container.
  4. Next, drag your 'Total Row' worksheet into the same container, directly below the first sheet.

Step 4: Clean Up the Formatting

At this point, it looks like two separate tables. The final step is to make them look like one.

  • Hide Titles: Right-click the title of each worksheet on the dashboard and select Hide Title.
  • Hide Headers: On your 'Total Row' worksheet, you don't need the "Category" header since it's already present in the sheet above. Right-click the "Category" pill on your 'Total Row' worksheet's Columns/Rows shelf and uncheck Show Header.
  • Adjust Formatting: Click on the 'Total Row' worksheet within the dashboard. Use the formatting pane to change the background color, bold the text, or make any other visual changes to help it stand out as a total.

After a little cleanup, you'll have a seamless table with a fully customized total row that you control completely.

Final Thoughts

There you have it - three effective ways to add total rows in Tableau, each serving a different purpose. For simple sums, the built-in Analysis > Totals feature is the fastest. For customized logic, a calculated field with the SIZE() function provides an elegant solution. And for complete design freedom, combining two worksheets on a dashboard is the professional's choice.

While powerful, tools like Tableau often require you to learn specific functions and workarounds to get the report you need. We believe getting insights from your data shouldn't involve hunting through menus or writing custom formulas. With Graphed , we connect directly to your data sources and let you build dashboards and ask questions in plain English. Just describe what you want to see - "show me total sales by sub-category as a table" - and the report is built automatically, letting you focus on the insights, not the configuration.

Related Articles