How to Change AGG to SUM in Tableau

Cody Schneider••8 min read

Seeing AGG wrapped around a field in Tableau can be disorienting, especially when an instructor or colleague’s version clearly says SUM. It often feels like you've done something wrong, but that's not usually the case. This article will explain what AGG() actually means, why you're seeing it, and several straightforward ways to fix it so you can get the simple sum you're looking for.

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

Understanding AGG() in Tableau

When you see a pill in Tableau that says AGG(), like AGG([Your Field]), it stands for aggregate. This is Tableau’s way of letting you know that the field is already an aggregated calculated value and can’t be further aggregated using standard functions like SUM(), AVG(), or MIN(). In other words, the aggregation logic is defined inside the calculation itself, not on the pill.

You can't right-click an AGG pill and change its aggregation type because the calculation has technically already been done. It's a multipurpose wrapper Tableau uses for more complex computations.

Here are the most common situations where you'll encounter AGG():

  • Your calculated field contains an aggregation. The most frequent cause. If your formula is something like SUM([Sales]) / SUM([Profit]), the result is already an aggregate (a ratio of two sums). Tableau can't "sum" this ratio again, so it wraps it in AGG().
  • You're using ATTR() (Attribute). ATTR() is an aggregation type itself. It checks if there is only one unique value for a given dimension in the view. If so, it returns that value, otherwise, it returns an asterisk (*). Sometimes, Tableau defaults measures to ATTR() depending on where you drop it.
  • You're using table calculations. Functions like WINDOW_SUM(), RUNNING_SUM(), and LOOKUP() operate on values that are already aggregated and present in your visualization. Therefore, they are always displayed with an AGG() wrapper.
  • Your formula includes aggregated IF/THEN logic. A statement like IF MIN([Order Date]) > #2023-01-01# THEN 'New Customer' ELSE 'Old Customer' END gets wrapped in AGG() because it evaluates an aggregate (MIN()) condition.

Remember, AGG() isn't an error. It's a status indicator from Tableau that says, "This field has a custom aggregation defined internally." To change it, you have to find where that aggregation is happening.

Why You Can't Simply Switch AGG to SUM

The core concept to remember is that you can’t aggregate an aggregation. Trying to change AGG() to SUM() on a pill is like trying to calculate the sum of a number that is already a sum. The operation doesn't make logical sense.

Think about a calculation for Profit Ratio: SUM([Profit]) / SUM([Sales]). If your total profit is $2,000 and total sales are $10,000, the Profit Ratio is 0.2, or 20%. Tableau calculates this for you and correctly displays AGG(Profit Ratio) in the view to show the result: 20%.

Now, what would it mean to SUM(Profit Ratio)? Would you sum 20%? With what? The number is already the result of an aggregation. You can't perform another simple sum on top of it.

So, the goal is not to force AGG to become SUM. The goal is to figure out why your field is pre-aggregated and address the source, which is almost always in the pill's aggregation setting or the formula of a calculated field.

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.

How to Get SUM Instead of AGG: Common Scenarios

Let's walk through the most common reasons you're seeing AGG() and the step-by-step solutions for each.

Scenario 1: You're Accidentally Using ATTR()

This is the simplest fix. Sometimes when you drag a measure onto a shelf like Text, Detail, or even Rows/Columns, Tableau defaults to using the ATTR() aggregation, especially if the visualization context is ambiguous. Since ATTR is an aggregation, it gets the AGG() wrapper.

You’ll know this is the issue if the formula you think you’re seeing is being displayed as AGG([Sales]), when what's really on the pill is ATTR([Sales]).

How to Fix It:

  1. Find the green pill in your Rows, Columns, or Marks shelf that says AGG([Your Measure]).
  2. Right-click on the pill to open the context menu.
  3. Hover your cursor over the “Measure” option.
  4. A sub-menu will fly out showing all the standard aggregation types.
  5. Select “Sum” from the list.

The pill will immediately change from AGG([Your Measure]) to SUM([Your Measure]), giving you the total you expected. If this option fixes it, you're done! If not, the issue likely lies within a calculated field.

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

Scenario 2: Fixing an Aggregated Calculated Field

This is where most users get stuck. If your calculated field contains any aggregation inside its formula (SUM, AVG, MIN, MAX, COUNTD, etc.), Tableau will wrap it in AGG() when you place it in the view. You created an aggregated measure, so it acts like one.

The key here is deciding if you want the calculation to compute for every single row of your data before being summed, or if you want it to compute on already aggregated values.

Method A: Refactor the Calculation to a Row-Level Formula

Imagine you want to calculate the sum of sales but only for the "Technology" category. A common first attempt in the calculated field editor might be:

// This version is an AGGREGATED calculation
IF ATTR([Category]) = 'Technology' THEN SUM([Sales]) END

Because this includes ATTR() and SUM(), Tableau will wrap it in AGG(). You cannot sum this result further.

To fix this, you need to rewrite it as a row-level calculation. A row-level calculation creates a value for every single row in your data source, before any aggregation takes place.

How to Fix It:

  1. Open your calculated field for editing (Right-click > Edit).
  2. Remove all aggregations from the formula so it operates on each row individually. The new formula should look like this:
// This version is a ROW-LEVEL calculation
IF [Category] = 'Technology' THEN [Sales] END
  1. Save this new calculated field. Let's name it "Tech Sales."
  2. Now drag "Tech Sales" into the view. By default, Tableau might apply SUM(), showing it as SUM([Tech Sales]).
  3. If it still shows up as AGG(), use the fix from Scenario 1: right-click the pill, go to Measure, and select Sum.

Because the new formula is row-level, Tableau can now group all the individual row values and apply a SUM aggregation to them. This approach puts you back in control of the aggregation.

Method B: Verify the Aggregation Logic

Sometimes, the AGG() is actually correct and intentional. For calculated fields like Profit Ratio (SUM([Profit])/SUM([Sales])) or Customer Order Frequency (COUNTD([Order ID]) / COUNTD([Customer ID])), the formulas must be aggregated. They simply wouldn’t make sense at a row level.

In these cases, don't try to get rid of the AGG() wrapper. Instead, double-check your formula to ensure the aggregations inside it are correct. Are you supposed to be summing or averaging? Using COUNT() or COUNTD()? The problem isn’t the AGG() wrapper, it may be the logic it's wrapping.

When AGG is Unavoidable: Table Calcs and Data Blending

There are a couple of situations in Tableau where you'll see AGG() and there's nothing you can (or should) do about it.

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.

Table Calculations

Table calculations perform computations on a table of aggregated data currently displayed in your worksheet. For example, a RUNNING_SUM(SUM([Sales])) calculates the running total of a measure that is already summed. Since the calculation's input (SUM([Sales])) is an aggregate, the output (your table calculation) must also be an aggregate. Tableau shows this with the AGG() wrapper, and it's perfectly normal.

Data Blending

Data blending is another area where AGG() is required behavior. When you bring in a measure from a secondary data source, Tableau must aggregate it first before it can be displayed alongside data from your primary source. This happens at the level of detail of the linking fields.

Consequently, any field from a secondary data source automatically comes in as an AGG. It may look like AGG([secondary_data_source].[Sales]) on your pill. This behavior is fundamental to how data blending works and cannot be changed. If you need row-level access, consider using a relationship or join to combine your data sources instead of a blend.

Final Thoughts

Seeing AGG() in Tableau isn’t a bug but a fundamental part of how it handles different levels of calculation. It simply means the value is already the result of an aggregation. To resolve it, check whether the pill is set to ATTR() by mistake, or rewrite a calculated field to operate at the row level before you bring it into your view for summing.

When reporting is just one of many hats you wear, wrestling with Tableau's aggregation logic for your marketing and sales data can be frustrating. We built Graphed so you don't have to worry about the difference between AGG() and SUM(). You can just ask your data questions in plain English, like "What's my total revenue by campaign?" and instantly get a live dashboard connected to your Google Analytics, Shopify, and ad accounts. It’s all the insight, with none of the data wrangling.

Related Articles