How to Get Aggregate in Tableau

Cody Schneider••7 min read

Working with data in Tableau means you're almost always working with aggregations. This is how Tableau takes massive datasets with thousands or millions of rows and boils them down into meaningful summaries, like total sales per quarter or average customer wait times. This guide will walk you through what aggregations are, how to use them, and how you can switch between different types to get the answers you need from your data.

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

What is Aggregation in Tableau?

In the simplest terms, aggregation is the process of taking many individual values and combining them into a single, summary value. When you drag a numerical field - what Tableau calls a "Measure" - into your view, Tableau automatically performs an aggregation on it. The default choice is almost always to sum the values.

For example, if you have a dataset of 10,000 individual sales transactions and you drag the "Sales" field onto your worksheet, Tableau won’t try to show you 10,000 different numbers. Instead, it will instantly show you one number: the total sum of all sales.

This is controlled by the "Dimensions" you use. Dimensions are categorical fields (like 'Region', 'Product Category', or 'Date') that slice your data. When you drag a dimension like 'Region' to the Rows shelf and the 'Sales' measure to the Columns shelf, Tableau automatically calculates the SUM(Sales) for each unique region. The dimension sets the level of detail (or the "grouping"), and the measure gets aggregated for each of those groups.

This automatic behavior is one of Tableau's most powerful features. It allows you to quickly see high-level trends and summaries without getting lost in the raw data.

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.

Common Aggregation Functions in Tableau

Tableau offers a variety of ways to aggregate your measures, and you can switch between them with just a few clicks. The right one to use depends entirely on the question you're trying to answer. Here are the most common ones you’ll encounter.

SUM

This is the workhorse of Tableau aggregations and the default for most numerical fields. It simply adds all the values together. It's perfect for answering questions about totals.

  • Question: "What were our total sales last year?"
  • Example: SUM([Sales]) gives you the grand total of the Sales column.

AVERAGE (AVG)

This function calculates the arithmetic mean of the values by summing them up and dividing by the count of rows. It's useful for understanding the typical value in a dataset.

  • Question: "What is the average order value?"
  • Example: AVG([Sales]) shows you the average sales amount per transaction.

MEDIAN

The Median returns the middle value in a set of sorted numbers. It's extremely useful when your data has outliers that might skew the average. For instance, in home prices, a few multi-million dollar sales can drastically increase the average, while the median gives a better representation of the "typical" home price.

  • Question: "What is the median customer age, ignoring extremely young or old outliers?"
  • Example: MEDIAN([Customer Age]) finds the middle age value.

COUNT (CNT) vs. COUNT DISTINCT (CNTD)

This is an important distinction to understand.

  • COUNT (CNT): This simply counts the number of rows in your selection. It answers "how many records are there?".
  • COUNT DISTINCT (CNTD): This counts the number of unique values in a field. It answers "how many different items are there?".

Let's clarify with an example. Imagine you have a list of sales, and you want to know about your customers.

  • `COUNT([Customer ID])` would give you the total number of sales transactions (e.g., 500 orders).
  • `COUNTD([Customer ID])` would give you the number of unique customers who made those sales (e.g., 150 unique customers).

MIN and MAX

These functions are straightforward: MIN finds the smallest value in your selection, and MAX finds the largest.

  • Question: "Show me the lowest and highest discount percentages offered."
  • Example: Use MIN([Discount]) to find the minimum discount and MAX([Discount]) for the highest.
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

ATTRIBUTE (ATTR)

The ATTR function is a bit unique. It checks if all the rows in your group have the exact same value. If they do, it displays that value. If they have different values, it displays an asterisk (). This is helpful when you need to display a label for a group but you first need to confirm the label is consistent across all group members. For example, if you wanted to display the 'Sales Rep Name' at a regional level, ATTR([Sales Rep Name]) would show the name only if one rep handled all sales in that region, otherwise, it would show ''.

How to Change Aggregations on Your Worksheet

Switching aggregation methods couldn't be easier in Tableau. Once you've added a measure to your view (like on the Rows, Columns, or Marks card), the measure "pill" will show its current aggregation (e.g., SUM(Profit)).

To change it, just follow these simple steps:

  1. Right-click (or click the small down arrow) on the green measure pill you want to change.
  2. Hover your cursor over the "Measure" option in the context menu.
  3. Another dropdown menu will appear with a list of all available aggregations (Average, Median, Count, Minimum, etc.).
  4. Select the aggregation you want to use. The pill in your view and the chart on your worksheet will instantly update to reflect the new calculation.

That's it! You can change it back or select a different method at any time for exploring the data from different perspectives.

When You Don’t Want Aggregation: Disaggregating Data

Sometimes, summary views hide the real story. You may not want a total or an average, you may want to see every individual data point. This is called disaggregating. For example, in a scatter plot, you want to plot every single mark to identify relationships, clusters, or outliers - not just a single aggregated point.

To turn aggregations off, go to the “Analysis” menu in the top toolbar and uncheck the “Aggregate Measures” option.

When you do this, Tableau will stop summarizing your data. Instead of SUM(Sales), your chart will now plot a mark for every single row in the data source. For very large data sets, caution should be exercised. This may hurt performance significantly. Disaggregate wisely when needed but keep measures aggregated for general analysis.

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.

Creating Ratios with Custom Aggregations

Tableau's built-in aggregations cover most standard scenarios, but what about when you want to create a custom calculation, like a Profit Ratio? You can't just take an average of the [Profit Ratio] column in your source data because that would be mathematically incorrect (averaging ratios is rarely what you want!). Instead, you need to calculate the ratio of the aggregates.

You can do this with a calculated field. Let's create Profit Ratio:

  1. In the Data pane, right-click and select "Create Calculated Field."
  2. Give your new field a name, like "Profit Ratio".
  3. Instead of writing [Profit] / [Sales], which would perform the calculation at each row, you need to first add up all the profit and sales, and then perform the division. You’d use the formula:
  4. Click OK. This new calculated field will appear in your Data pane, and you can now drag this into your view for the aggregate calculation of the 'Profit' and 'Sales'.

This method ensures the math is correct according to the level of detail already defined in your chart, which gives you accurate data-at-a-glance. Using aggregated calculations is important for building almost any KPI analysis, like conversion rates (SUM(Conversions) / SUM(Sessions)) or cost per acquisition (SUM(Spend) / SUM(Acquisitions)).

Final Thoughts

Mastering aggregations is a fundamental step toward proficiency in Tableau. Understanding how Tableau summarizes your data, how to change the aggregation method, and when to create your own custom aggregated calculations allows you to move beyond basic charts toward creating insightful, decision-driving analyses.

Of course, becoming an expert in tools like Tableau takes time and patience - you have to learn the interface, understand the underlying data logic, and wrestle with calculated fields for every new KPI. For teams that want to get answers fast without a steep learning curve, we built Graphed. We connect directly to your data sources like Google Analytics, Shopify, and Salesforce, and allow you to simply ask questions in plain English - like "create a line chart showing our total revenue and ad spend from Facebook ads last quarter” - and watch as interactive, real-time dashboards are built for you in seconds.

Related Articles