DAX function
AVERAGEX — DAX function reference
Mean of a per-row expression.
Syntax
dax
AVERAGEX(<table>, <expression>)
Examples
dax
AVERAGEX(Sales, Sales[Qty] * Sales[Price])
→ A number
CALCULATE triggers context transition so SUM re-evaluates for each OrderID rather than averaging individual line amounts.
dax
AVERAGEX(VALUES(Sales[OrderID]), CALCULATE(SUM(Sales[Amount])))
→ Average order value at the order level, not the line level
dax
AVERAGEX(Product, [Total Sales])
→ Average product's sales, including products that sold nothing
Common mistakes & gotchas
- Without wrapping the expression in CALCULATE (or a measure reference, which implicitly wraps CALCULATE), AVERAGEX(VALUES(Sales[OrderID]), Sales[Amount]) just averages line amounts, not order totals.
- Rows that evaluate to BLANK() are excluded from both the sum and the row count DAX uses internally, which can make the result differ from a hand-checked DIVIDE(SUM, COUNTROWS).
Related DAX functions
From Aggregations