DAX AVERAGEX Function

Compute averages over entities rather than individual transactional rows.

Syntax
AVERAGEX( Table, Expression )

Overview

AVERAGEX iterates over a table, evaluates an expression for each row, and computes the arithmetic mean of the resulting values.

AVERAGEX is crucial when calculating averages of higher-level entities, such as Average Revenue per Customer or Average Daily Orders. By passing a dimension table like Customers or Dates, each entity is evaluated individually before averaging.

Avg Customer Spend = 
AVERAGEX(
    Customers,
    [Total Revenue]
)

When to use AVERAGEX

  • Averaging a value computed per row or per item, such as average order value across orders.
  • Averaging a measure across a dimension, such as average monthly sales across the months in the period.
  • Any average where the grain matters — per order, per customer, per day — and must be explicit.

Worked examples

Average order value

Avg Order Value =
AVERAGEX (
    VALUES ( Sales[Order ID] ),
    CALCULATE ( SUM ( Sales[Amount] ) )
)

Averaging Sales[Amount] directly would average order lines, not orders. Iterating distinct order IDs and summing each order first gives the average per order.

Average monthly sales

Avg Monthly Sales =
AVERAGEX ( VALUES ( 'Date'[Year Month] ), [Total Sales] )

Iterating the months in the current filter context and averaging the monthly totals answers "what does a typical month look like?" — something AVERAGE over the fact table cannot.

Common mistakes

  • Confusing AVERAGE(Sales[Revenue]) with AVERAGEX(Customers, [Total Revenue])—they answer fundamentally different business questions.
  • Zeroes vs Blanks: AVERAGEX ignores rows that evaluate to BLANK(), but includes rows that return 0.

Performance notes

Like other iterators, AVERAGEX is cheap over a small table and expensive over a large one when the expression references measures. Iterating distinct values of a key or a dimension column, rather than the fact table, usually keeps it fast.

Frequently asked questions

What is the difference between AVERAGE and AVERAGEX?
AVERAGE averages the values of one column at row level. AVERAGEX evaluates an expression for each row of a table you choose and averages the results, letting you control the grain.
Does AVERAGEX ignore blanks?
Yes. Rows where the expression returns blank are excluded from both the sum and the count. Rows returning zero are included, so 0 versus BLANK changes the result.
Why is my average different from Excel's?
Usually the grain differs: Excel averaged one row per order while the DAX averaged order lines (or the reverse). Make the grain explicit with AVERAGEX over the right table.

Related DAX concepts