What is AGG in Tableau?

Cody Schneider8 min read

If you've spent any time with Tableau, you've probably dragged a calculated field into your view and seen an unfamiliar prefix pop up on the pill: AGG. Seeing AGG(Your Calculation) for the first time can be confusing. Is it an error? Is it a function you forgot to add? This article will clear up exactly what AGG means, why Tableau uses it, and how understanding it is fundamental to mastering your data visualizations.

So, What Does "Aggregate" Actually Mean?

Before we can understand the AGG pill, we need to understand the concept of aggregation. At its core, aggregation is the process of combining many individual data points into a single, summary value.

Think about a physical grocery store receipt. The receipt lists every single item you bought: "Milk - $3.50", "Bread - $2.75", "Eggs - $4.00". Each line item is a piece of disaggregated, or row-level, data. Now, look at the bottom of the receipt. You'll see "Subtotal: $10.25". That subtotal is an aggregation. It’s a single value (a SUM) that summarizes all the individual item prices.

Data analytics works the same way. You might have thousands of individual sales records in your database, but you're usually more interested in summary figures like:

  • Total sales for the month (a SUM)
  • Average order value (an AVERAGE)
  • The number of transactions (a COUNT)
  • The highest-priced item sold (a MAX)
  • The lowest-priced item sold (a MIN)

All of these - SUM, AVERAGE, COUNT, MIN, and MAX - are types of aggregations. They take a pile of data and boil it down to a single, meaningful number.

Meet the Stars: Blue Pills vs. Green Pills

Tableau cleverly visualizes the difference between disaggregated and aggregated data using color. This is one of the most important concepts for a new user to grasp.

Blue Pills = Discrete (and Disaggregated)

Blue pills represent discrete data. Think of "discrete" as "distinct" or "individually separate." These are typically dimensions - fields you use to categorize or slice your data. When you drag a blue pill onto the Rows or Columns shelf, it creates headers or labels.

  • Examples: Product Category ("Furniture", "Office Supplies", "Technology"), Region ("East", "West"), Customer Name ("John Smith", "Jane Doe").
  • Function: They slice up your view. Each value creates a separate pane or column.

Green Pills = Continuous (and Aggregated)

Green pills represent continuous data. Think of "continuous" as a measurable spectrum. These are typically measures - the numbers you want to analyze. When you drag a green pill onto the canvas, Tableau automatically creates an axis because it can be an infinite range of values.

  • Examples: Sales ($154.67, $2,010.55), Profit (-$50.23, $899.12), Quantity (1, 2, 5).
  • Function: They are the numbers to be plotted. Tableau automatically aggregates them, usually as a SUM, when you pull them into the view. For instance, dragging Sales to the Rows shelf will instantly become SUM(Sales).

Understanding this color-coded system is the first step. Blue pills provide the "what" - the categories. Green pills provide the "how much" - the aggregated values for those categories.

Finally, the AGG Pill Explained

Now we get to the heart of the matter. You see the AGG() prefix on a pill in Tableau when the field in question already contains an aggregation within its formula.

In simple terms, AGG() is Tableau's way of telling you: "Hey, this is a pre-aggregated calculation. I don't need to wrap it in a SUM() or AVG() because you've already defined how it should be calculated."

It's a status indicator, not an applied function. You won't find AGG() in the function list when creating a calculated field. It only appears on the pill in the view.

When Does AGG Show Up? The Most Common Scenarios

1. Creating a Calculated Field with Aggregations

This is by far the most common reason you’ll encounter AGG(). Let's say you want to calculate the Profit Ratio. The formula for this is Total Profit divided by Total Sales. In Tableau, you’d create a calculated field like this:

SUM([Profit]) / SUM([Sales])

Since you’ve already used the SUM() aggregation in your formula, the result is an aggregated value. You've told Tableau precisely how to combine the profit and sales data before performing the division. When you drag your new 'Profit Ratio' calculated field into the view, the pill will read AGG(Profit Ratio).

Tableau does this because it would be nonsensical to apply another aggregation on top. What would SUM(Profit Ratio) even mean? That would be SUM(SUM([Profit]) / SUM([Sales])), which doesn’t make logical sense in most analyses and can produce incorrect results.

2. Working with Blended Data

If you're blending data from two or more different sources, measures that you bring in from the secondary data source will always be aggregated. This is because Tableau must aggregate the data from the secondary source to match the level of detail of the primary source. As a result, when you drag a measure from a secondary source into your view, it will be prefixed with AGG().

3. Using Certain Table Calculations

Table calculations like ATTR() (Attribute) are also aggregations. If a calculated field uses ATTR([Customer Name]) for example, it will appear as AGG([Your Field]) in the view, since the aggregation (ATTR) is built into the calculation's logic from the start.

The #1 Problem AGG Helps You Solve: The "Cannot Mix Aggregate..." Error

One of the most frequent and frustrating errors for Tableau beginners is the classic: "Cannot mix aggregate and non-aggregate comparisons or results in an IF expression."

Seeing AGG() on a pill is often your first clue that you might run into this issue if you’re not careful. This error happens when you try to compare a value that exists for every row (disaggregated) with a value that has been summarized across many rows (aggregated).

Let's look at a common mistake:

“I want to identify any category where a single sale was higher than the average sale for that category.”

A new user might write a calculated field like this:

// This formula will cause an error IF [Sales] > AVG([Sales]) THEN "Above Average Transaction" ELSE "Met or Below Average Transaction" END

Tableau will instantly reject this. Why?

  • [Sales] is a non-aggregate value. It refers to the sales value in every single row of your data.
  • AVG([Sales]) is an aggregate value. It refers to a single number: the average of all sales values within the context of your view (e.g., across a whole category or region).

You're trying to compare a bag full of individual receipts ([Sales]) to a single summary number (AVG([Sales])). It’s an apples-to-oranges comparison that doesn't compute at a row level.

How to Fix Aggregate and Non-Aggregate Errors

The solution is to make sure you're comparing things at the same level of detail. Typically, you need to either aggregate the non-aggregated field or disaggregate the aggregated one (though the first is more common).

Solution 1: Aggregate the other field

Bring both fields down to the same aggregate level. This makes sense if you want to perform the check on an aggregated viz rather than row by row.

// Compare AGG to AGG IF SUM([Sales]) > AVG([Sales]) THEN ...

This asks a fundamentally different question: "Is the total sales for this mark greater than the average of all sales?" This may or may not be the logic you're after, but it resolves the error because you're now comparing an aggregate to an aggregate.

Solution 2: Use a Level of Detail (LOD) Expression

LOD expressions are the ultimate Swiss Army knife for this problem. They allow you to compute an aggregated value but return it as a row-level result, letting you do row-by-row comparisons.

To fix our earlier formula, you could use a FIXED LOD to calculate the average sales for the whole dataset (or by category) and use it in your row-level calculation:

// Pre-calculates the average across an entire category {FIXED [Category]: AVG([Sales]) }

Now, you can use that inside your IF statement without error:

// This formula works perfectly! IF [Sales] > {FIXED [Category]: AVG([Sales])} THEN "Above Category Avg Sale" ELSE "Regular Sale" END

Here, for every row of data, the calculation compares the [Sales] value from that row to the single, pre-calculated average for its corresponding category. Both values now exist on every row, so the comparison is valid.

Final Thoughts

At the end of the day, that AGG() prefix is your helpful guide, not an error. It provides valuable context about the nature of your calculation, reminding you that you're working with a summary figure rather than a row-level detail. Understanding this fundamental concept of aggregation is the key that unlocks your ability to build more complex, powerful, and error-free analyses in Tableau.

When working with our customers, we notice that the most time-consuming part of analytics isn't creating the final chart - it’s the frustrating, manual process of exporting data, fighting cryptic error messages, and wrangling calculations in complex tools. This is precisely the friction we built Graphed to remove. We've automated that manual drudgery, you can simply describe the report or dashboard you need in plain English ("Show me my profit ratio by product category over the last year"), and we build it live for you, without requiring you to become an expert on aggregations or troubleshoot formulas.

Related Articles

How to Connect Facebook to Google Data Studio: The Complete Guide for 2026

Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.

Appsflyer vs Mixpanel​: Complete 2026 Comparison Guide

The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.