All DAX Functions

AVERAGE vs AVERAGEX: Standard Averages vs Row-by-Row Averages

Single-column averages versus custom per-row expressions.

On this page

Overview

AVERAGE returns the arithmetic mean of values in a single column. AVERAGEX iterates over a table, evaluates an expression for each row, then averages those results—essential when the value to average is computed from multiple columns.

Choosing the wrong function leads to incorrect insights: averaging pre-aggregated totals is not the same as averaging per-line calculations.

Syntax

AVERAGE
AVERAGE(<column>)
AVERAGEX
AVERAGEX(<table>, <expression>)
  • AVERAGE: Mean of one numeric column in the current filter context.
  • AVERAGEX: Mean of an expression evaluated row by row across <table>.

Example & Dataset

An OrderDetails table with quantity and unit price per line (discount not stored):

Sample Data Table: OrderDetails

LineIDOrderIDQuantityUnitPriceDiscountPct
L01O1002500.10
L02O10011000.00
L03O1015200.20
L04O1011800.05

The DAX Code

AVERAGE on UnitPrice ignores quantity and discount. AVERAGEX computes the net line amount per row, then averages:

AVERAGE — Mean unit price only
Avg Unit Price =
AVERAGE( OrderDetails[UnitPrice] )
AVERAGEX — Mean discounted line value
Avg Line Value =
AVERAGEX(
    OrderDetails,
    OrderDetails[Quantity]
        * OrderDetails[UnitPrice]
        * ( 1 - OrderDetails[DiscountPct] )
)

Expected Output Visual

AVERAGE vs AVERAGEX Results

MeasureLogicResult
Avg Unit PriceMean of UnitPrice column62.50
Avg Line ValueMean of (Qty × Price × (1 − Discount))86.25

AVERAGEX Line Values

LineIDLine Value (after discount)
L0190.00(2×50×0.9)
L02100.00
L0380.00(5×20×0.8)
L0476.00(1×80×0.95)
Avg Line Value86.25(90+100+80+76)/4

Why Did This Output Happen?

AVERAGE simply averages 50, 100, 20, 80 = 62.50. AVERAGEX first calculates each line's discounted extended value (90, 100, 80, 76), then averages those four numbers: 346 ÷ 4 = 86.25. For pricing and basket analysis, AVERAGEX reflects true per-line economics; AVERAGE of a single column can mislead when quantity and discounts vary.