Was this page helpful?
Yes No
Have a comment? Please leave it here. Thanks for your feedback!
All Tableau Help > Tableau Desktop and Web Authoring Help > 
Applies to: Tableau Desktop, Tableau Online, Tableau Public, Tableau Server

Aggregate Functions in Tableau

This article introduces aggregate functions and their uses in Tableau. It also demonstrates how to create an aggregate calculation using an example.

In this article

Why use aggregate functions

Aggregate functions available in Tableau

Create an aggregate calculation

Rules for aggregate calculations

Why use aggregate functions

Aggregate functions allow you to summarize or change the granularity of your data.

For example, you might want to know exactly how many orders your store had for a particular year. You can use the COUNTD function to summarize the exact number of orders your company had, and then break the visualization down by year.

The calculation might look something like this:


The visualization might look something like this:

Aggregate functions available in Tableau

The following aggregate functions are available in Tableau for you to use:

For more detailed definitions of these functions, as well as syntax and examples, see Tableau Functions (by Category) and select Aggregate functions. There are also several built in aggregations in Tableau. For more information, see Aggregations.

Create an aggregate calculation

Follow along with the steps below to learn how to create an aggregate calculation.

  1. In Tableau Desktop, connect to the Sample - Superstore saved data source, which comes with Tableau.

  2. Navigate to a worksheet and select Analysis > Create Calculated Field.

  3. In the calculation editor that opens, do the following:

    The new aggregate calculation appears under Measures in the Data pane. Just like your other fields, you can use it in one or more visualizations.

    Note: Aggregation calculations are always measures.

    When Margin is placed on a shelf or card in the worksheet, its name is changed to AGG(Margin), which indicates that it is an aggregate calculation and cannot be aggregated any further.

    A graphic depicting what happens when you place an aggregate
calculation on a shelf. The field displays the AGG prefix.

Rules for aggregate calculations

The rules that apply to aggregate calculations are as follows:

See Also

Understanding Calculations: Aggregate Calculations


Functions in Tableau

Tableau Functions (by Category)

Tableau Functions (Alphabetical)