Tableau provides various Aggregate Functions, which helps you to perform aggregations such as calculating sum, avg, minimum, maximum etc. In this article, we will show you, How to use Tableau Aggregate Functions with examples.

To demonstrate these Tableau Aggregate Functions, we are going to use the data source that we created in our previous article. So, Please visit Data Labels in Tableau Reports article.

## Tableau Aggregate Functions

The following examples will show you the list of Aggregate Functions in Tableau

### Tableau Sum Function

The Tableau Sum function is used to find the Sum of records in a column. The basic syntax of this Tableau Sum Function is as shown below:

SUM(Expression)

To demonstrate these aggregate functions, we have to use the Calculated Field. In order to create a calculated field, please navigate to Analysis Tab and select the **Create Calculated Field…** option as shown below.

Once you click on the **Create ****Calculated Field…** option, following window will be opened. Here, we renamed the default calculation name as Sum_Of_Sales.

As you can see from the below screenshot, while I was typing, Tableau calculation window is showing the suggestions.

For the demo purpose, we will calculate the Sum of Sales Amount. By clicking the OK button, a new field called Sum_Of_Sales will be created. And the final Code is

SUM([SalesAmount])

Now you can see our newly created calculated filed

Let me create a Bar Chart by dragging Country to **Columns** Shelf, Sum_Of_Sales (new calculated field) to **Rows** shelf, and Country to **Colors** shelf.

### Tableau Avg Function

The Tableau Avg or average function is used to calculate the Average. The syntax of this Tableau AVG Function is as shown below:

AVG(Expression)

As you can see from the below screenshot, we are creating a new field (Sales Average).

AVG([SalesAmount])

Click OK to close the window

Let me replace the Sum of Sales field in **Rows** shelf with this Sales Average field.

### Tableau MIN Function

The Tableau MIN function is used to find the minimum value. The syntax of this Tableau MIN Function is as shown below:

MIN(Expression)

As you can see from the below screenshot, we are creating a new field called Minimum Sales.

MIN([SalesAmount])

Let me place the Minimum Sales field in **Rows** shelf, and Color dimension in Columns Shelf.

In Tableau, MIN function accepts two arguments. Use this to find the smallest between two numbers. Syntax is:

MIN(Expression1, Expression2)

Here, we created a new field Minimum_Sales_Cost to find the smallest value between the Sales Amount and Total Product Cost.

Let me add Minimum Sales_Cost, Sales Amount and Total Product Cost to the chart

### Tableau MAX Function

The Tableau MAX function is used to find the maximum value. The syntax of this Tableau MAX is as shown below:

MAX(Expression)

You can see from the screenshot, we are creating a new field called Maximum Sales.

MAX([SalesAmount])

Let me replace the Minimum Sales field in **Rows** shelf with Maximum Sales field.

In Tableau, MAX function accepts two arguments. Use this to find the largest among two numbers. Syntax is:

MAX(Expression 1, Expression 2)

Here, we created a new field Maximum_Sales_By_Cost to find the largest value among the Sales Amount and Total Product Cost.

Let me add Maximum Sales_By_Cost, Sales Amount and Total Product Cost to the chart

### Tableau VAR Function

The Tableau VAR function is used to find the Variance of the sample population. The syntax of this Tableau VAR is as shown below:

VAR(Expression)

As you can see from the below screenshot, we are creating a new field called Sales_Variance.

VAR([SalesAmount])

Click OK to close the window

### Tableau VARP Function

The Tableau VARP function is used to find the Variance of the entire population. Syntax :

VARP(Expression)

Let me create a new field called Sales_PVariance.

VARP([SalesAmount])

Click OK to close the window

Let me add those two variances to the column chart

### Tableau STDEV Function

The Tableau STDEV function is used to find the standard deviation of the sample population. The syntax of this Tableau STDEV is as shown below:

STDEV(Expression)

As you can see from the below screenshot, we are creating a new field called Sales_StdDeviation.

STDEV([SalesAmount])

Click OK to close the window

### Tableau STDEVP Function

The Tableau STDEVP function is for finding the standard deviation of the entire population. The syntax of this Tableau STDEVP is:

STDEVP(Expression)

Let me create a new field called Sales_StdDeviationP.

STDEVP([SalesAmount])

Let me add those two standard deviations to the column chart

### Tableau COUNT Function

The Tableau COUNT function is used to find a number of not null values. The syntax of this Tableau COUNT is as shown below:

COUNT(Expression)

As you can see from the below screenshot, we are creating a new field called Count_Orders.

COUNT([OrderQuantity])

Click OK to close the window

**TIP:** Use COUNTD function to get the distinct count.

Let me add this to Row Field