Microsoft Power BI DAX provides various Aggregate Functions, which allows us to perform aggregations such as: calculating sum, average, minimum, maximum etc. In this article we will how you, How to use Aggregate Functions in Power BI DAX with examples.

To demonstrate these Power BI DAX aggregate functions, we are going to use the below shown data. As you can see, there are 15 records in this table.

## Power BI DAX Aggregate Functions

The following examples will show you the list of DAX Aggregate Functions in Power BI

### Power BI DAX Sum Function

The DAX Sum function is used to calculate the total or Sum of records in a column. The basic syntax of the Power BI DAX Sum Function is as shown below:

Measure Name = SUM(Expression or Column Name)

To demonstrate these aggregations, we have to use Measures. In order to create a measure, please click on the **New Measure** option under the **Home** tab, or **Modeling **tab.

We renamed the default measure name as Sales Sum. As you can see from the below screenshot, while I was typing, Power BI intellisense is showing the suggestions.

Let me select SUM function

For the demo purpose, we will calculate the Sum of Sales in this table

By clicking the enter or any key, a new Measure called SalesSum will be created. And the final Code is

SalesSum = SUM(EmployeeSales[Sales])

Let me create a Card using this Measure. Please refer Create a Card and Format Card articles to understand the steps involved in creating and formatting cards.

### Power BI DAX Average Function

The DAX Average function is used to calculate the Average of records in a column. The basic syntax of the Power BI DAX Average Function is as shown below:

Measure Name = AVERAGE(Expression or Column Name)

As you can see from the below screenshot, we created a Measure (named as AVGSale) to calculate the Sales column average. And the Code is

AVGSale = AVERAGE(EmployeeSales[Sales])

Next, let me create a Card using this Average Measure.

### Power BI DAX MIN Function

The DAX MIN function is used to find the Minimum value in a column. The syntax of the Power BI DAX MIN Function is as shown below:

Measure Name = MIN(Expression or Column Name)

As you can see from the below screenshot, we created a Measure (named as MinSale) to find the Minimum Sales amount in Sales column. And the Code is

MinSale = MIN(EmployeeSales[Sales])

Next, let me create a Card using this Minimum Measure.

### Power BI DAX MAX Function

The DAX MAX function is used to find the Maximum value in a column. The syntax of the Power BI DAX MAX Function is as shown below:

Measure Name = MAX(Expression or Column Name)

Here, we created a Measure (named as MaxSale) to find the Maximum Sales amount in Sales column. And the Code is

MaxSale = MAX(EmployeeSales[Sales])

### Power BI DAX COUNT Function

The DAX COUNT function is used to count number of numeric records in a column. The syntax of the Power BI DAX Count Function is as shown below:

Measure Name = COUNT(Expression or Column Name)

Here, we created a Measure (named as CountSale) to count the number of numeric records in New Sales column. And the Code is

CountSales = COUNT(EmployeeSales[NewSale])

### Power BI DAX VAR.S Function

The DAX VAR.S function is used to find the statistical Variance of complete records. Syntax of the Power BI DAX VAR.S Function is as shown below:

Measure Name = VAR.S(Expression or Column Name)

Here, we created a Measure (named as VarSIncome) to find the statistical Variance of a Yearly Income column. And the Code is

VarSIncome = VAR.S(EmployeeSales[YearlyIncome])

### Power BI DAX VAR.P Function

The DAX VAR.P function is used to find the statistical variance of selected or some records. The basic syntax of the Power BI DAX VAR.P Function is as shown below:

Measure Name = VAR.P(Expression or Column Name)

Here, we created a Measure (named as VarSIncome) to find the statistical P Variance of a Yearly Income column. And the Code is

VarPIncome = VAR.P(EmployeeSales[YearlyIncome])

### Power BI DAX STDEV.P Function

The DAX STDEV.P function is used to find the standard deviance of selected records. The basic syntax of the Power BI DAX STDEV.P Function is as shown below:

Measure Name = STDEV.P(Expression or Column Name)

Here, we created a Measure (named as STDEVPIncome) to find the standard deviance of a Yearly Income column. And the Code is

StdevPIncome = STDEV.P(EmployeeSales[YearlyIncome])

### Power BI DAX STDEV.S Function

The DAX STDEV.P function is used to find the standard deviance of complete records. The basic syntax of the Power BI DAX STDEV.S Function is as shown below:

Measure Name = STDEV.S(Expression or Column Name)

Here, we created a Measure (named as STDEVSIncome) to find the standard deviance of a Yearly Income column. And the Code is

StdevSIncome = STDEV.S(EmployeeSales[YearlyIncome])

Let me create a new card for the Standard Device Measure

### Power BI DAX MAX Function Example 2

The DAX MAX function also accepts two arguments. You can use this function to find the Max value between those two. Syntax is:

Measure Name = MAX(Expression1, Expression2)

Here, we created a new column (named as MaxValue) to find the largest value in-between the Sales and the Average Sales. I suggest you to refer Create a Column article to understand the steps involved in creating column.

### Power BI DAX MIN Function Example 2

In Power BI, DAX MIN function accepts two arguments. Use this function to find the smallest value between two numbers. Syntax is:

Measure Name = MIN(Expression1, Expression2)

Here, we created a new column (named as MinValue) to find the smallest value between the Sales and Average Sales.

Let me add those two Max Value, and Min Value columns to this table.

## Leave a Reply