Average, Averagea & Averagex Functions
Average, Averagea & Averagex Functions
Functions
by Power BI Docs
DAX
Syntax:
AVERAGE(<Column>)Copy
Description:
1 column The column that contains the numbers for which you want the average.
1 TRUE 29/5/2020 A
2 1000 FALSE B
Note:
1. This function takes the specified column as an argument and finds the average of
the values in that column.
2. Does not support Logical value & Text Value
3. Cells with the value zero are included.
4. If Data type is Integer/ Numeric/ Decimal, Average skip the null value.
Let’s create measure for Average function with different-different columns
AVERAGE 1 =
Copy
AVERAGE 2=
AVERAGE(SampleTable[Amount])Copy
Output = 1333.33, Amount column contains 3 values with 1 blank value, so total no of
rows are 4 but Amount column data type is Int. So Avg skip the null value now total no
of rows are 3 and it will divide total sum of amount with 3.
AVERAGEA(<Column>)Copy
Description:
1 column The column that contains the numbers for which you want the average.
Note :
The AVERAGEA function takes a column and averages the numbers, but also handles
non-numeric data types according to the following rules:
AVERAGEA 1 =
As per Sample data set we have 2 True values & 2 False values under “Boolean” column,
So AVERAGEA consider True as 1 and False as 0, that’s mean Total Sum of Boolean
column values are 2 and no of values are 4, so it will divide 2 with 4 and ans will be 0.50.
Syntax:
AVERAGEX(<table>,<expression>)Copy
Description:
An expression with a scalar result, which will be evaluated for each row of the table in t
2 expression
first argument.
Note:
1. The function takes a table as its first argument, and an expression as the second
argument.
2. The AVERAGEX function enables you to evaluate expressions for each row of a
table, and then take the resulting set of values and calculate its arithmetic mean.
3. You cannot include non-numeric or null cells. Both the table and expression
arguments are required.
4. When there are no rows to aggregate, the function returns a blank. When there
are rows, but none of them meet the specified criteria, then the function returns
0.
5. Does not support Logical/ boolean values.
Let’s create measure for AVERAGEX function with different-different columns
AVERAGEX 1 =
AVERAGEX(SampleTable,SampleTable[ID])Copy
Copy
AVERAGEX(
FILTER(SampleTable, SampleTable[Amount]=1000),
SampleTable[Amount]
Output = 1000Copy
Hope you enjoyed the post. Your valuable feedback, question, or comments about this
post are always welcome or you can leave us message on our contact form , we will
revert to you asap.