October 2, 2020
DAX functions
For Power BI version 2.76.5678.782 (December 2019).
Let’s look at the most common functions we use when working with DAX. All functions in this article (except for the function DIVIDE) are aggregator functions. This means they take a column (or table) as input and aggregate the values into a single result.
SUM()
Returns the sum of all the values in a column.
Syntax
SUM([Column])
Parameter | Description |
Column | Column to be aggregated. |
Example
SUM_Example = SUM(Sales[Amount])
Example calculates the sum of Amount column in the Sales table.
AVERAGE()
Returns the average of all the values in a column.
Syntax
AVERAGE([Column])
Parameter | Description |
Column | Column to be aggregated. |
Example
AVERAGE_Example = AVERAGE(Sales[Amount])
Example calculates the average of Amount column in the Sales table.
MIN()
Returns the lowest of all the values in a column.
Syntax
MIN([Column])
Parameter | Description |
Column | Column of values. |
Example
MIN_Example = MIN(Sales[Amount])
Example returns the lowest value of Amount column in the Sales table.
MAX()
Returns the highest of all the values in a column.
Syntax
MAX([Column])
Parameter | Description |
Column | Column of values. |
Example
MAX_Example = MAX(Sales[Amount])
Example returns the highest value of Amount column in the Sales table.
COUNT()
Returns the number of non-empty values in a column.
Syntax
COUNT([Column])
Parameter | Description |
Column | Column of values. |
Example
COUNT_Example = COUNT(Sales[Amount])
Example returns the number of non-empty values of Amount column in the Sales table.
COUNTBLANK()
Returns the number of empty values in a column.
Syntax
COUNTBLANK([Column])
Parameter | Description |
Column | Column of values. |
Example
COUNTBLANK_Example = COUNTBLANK(Sales[Amount])
Example returns the number of empty values of Amount column in the Sales table.
COUNTROWS()
Returns the number of rows in a table.
Syntax
COUNTROWS(Table)
Parameter | Description |
Table | Table we want to count rows in. |
Example
COUNTROWS_Example = COUNTROWS(‘Sales’)
Example returns the number of rows the Sales table.
DIVIDE()
Divides and returns the result. Returns BLANK in the case of dividing by 0.
Syntax
DIVIDE(Numerator, Denominator, [Alternative result])
Parameter | Description |
Numerator | Numerator |
Denominator | Denominator |
Alternative result | Alternative result in case of errors or dividing by 0. If no alternative result is given, BLANK is used. (optional) |
Example
DIVIDE_Example = DIVIDE(10, 2)
Example divides 10 by 2 and returns 5.