0
0
Power-biHow-ToBeginner ยท 3 min read

How to Use AVERAGE Function in DAX for Power BI

In Power BI, use the AVERAGE function in DAX to calculate the mean of a numeric column. The syntax is AVERAGE(ColumnName), which returns the average value of all numbers in that column.
๐Ÿ“

Syntax

The AVERAGE function in DAX calculates the average (arithmetic mean) of all the numbers in a column.

  • ColumnName: The column containing numeric values to average.
DAX
AVERAGE(ColumnName)
๐Ÿ’ป

Example

This example shows how to create a measure that calculates the average sales amount from a Sales[Amount] column.

DAX
Average Sales = AVERAGE(Sales[Amount])
Output
If Sales[Amount] contains values {100, 200, 300}, the measure returns 200
โš ๏ธ

Common Pitfalls

Common mistakes when using AVERAGE include:

  • Using it on non-numeric columns causes errors.
  • Expecting it to ignore blanks; it ignores blanks but includes zeros.
  • Confusing AVERAGE with AVERAGEX, which works on expressions over tables.
DAX
/* Wrong: Using AVERAGE on a text column */
Average Customer = AVERAGE(Customers[Name])

/* Right: Use AVERAGE only on numeric columns */
Average Age = AVERAGE(Customers[Age])
๐Ÿ“Š

Quick Reference

FunctionDescriptionExample
AVERAGECalculates average of a numeric columnAVERAGE(Sales[Amount])
AVERAGEXCalculates average of an expression over a tableAVERAGEX(Sales, Sales[Amount] * 1.1)
AVERAGEACalculates average including TRUE/FALSE as 1/0AVERAGEA(Survey[Response])
โœ…

Key Takeaways

Use AVERAGE(Column) to find the mean of numeric values in a column.
AVERAGE ignores blank values but includes zeros in the calculation.
Do not use AVERAGE on text or non-numeric columns to avoid errors.
For more complex calculations, consider AVERAGEX which works on expressions.
Always check your data type before applying AVERAGE to ensure correct results.