Median(Sales), Mode(Product), Stdev(Sales)

Median, Mode and Stdev in Power BI

Median and Stdev have direct DAX functions: MEDIAN/MEDIANX and STDEV.S/STDEVX.S (Qlik's Stdev is the sample version). Mode has no DAX function. Use TOPN over a grouped table, and decide what happens on ties, which Qlik answers with NULL.

Partial / different approach DAX

Short answer: Median(x) becomes MEDIAN(T[x]), Stdev(x) becomes STDEV.S(T[x]), and the Aggr versions use MEDIANX and STDEVX.S over VALUES(...). For Mode, use a TOPN(1) by COUNTROWS with a tie check.

What it does in Qlik

  • Median(expr) returns the middle value, interpolating with an even count.
  • Stdev(expr) returns the standard deviation of a sample (n-1 in the denominator).
  • Mode(expr) returns the most frequent value. When several values tie for most frequent, it returns NULL.

Qlik example

Qlik chart expressions
Median(OrderValue)
Median(Aggr(Sum(Sales), Customer))
Stdev(Sales)
Mode(Product)

Power BI equivalent

Median and standard deviation (DAX)

DAX
Median order value = MEDIAN ( Orders[OrderValue] )

Median customer sales = MEDIANX ( VALUES ( Customer[CustomerID] ), [Sales] )

Stdev sales = STDEV.S ( Sales[Amount] )

Mode with the Qlik tie rule (DAX)

DAX
Most common product =
VAR counts =
    ADDCOLUMNS ( VALUES ( Sales[Product] ), "@n", CALCULATE ( COUNTROWS ( Sales ) ) )
VAR maxN = MAXX ( counts, [@n] )
VAR winners = FILTER ( counts, [@n] = maxN )
RETURN IF ( COUNTROWS ( winners ) = 1, MAXX ( winners, Sales[Product] ) )

Returning BLANK on ties mirrors Qlik. To pick one winner instead, use CONCATENATEX(winners, Sales[Product], ", ") or a tie-breaker.

Gotchas and behaviour differences

  • Use STDEV.S, not STDEV.P. Qlik's Stdev divides by n-1, and only STDEV.P divides by n.
  • Mode counts rows where the value occurs. If your Qlik expression was Mode(Aggr(...)), build the inner table first and count occurrences of the measure values.
  • MEDIAN on a large column is much slower than SUM because it can't be pre-aggregated. Avoid it in visuals with many rows.

Official documentation

Related pages

Spotted an error or a better pattern? QlikToDax is maintained by a working BI consultant; corrections are welcome via the About page. Last reviewed 2026-10-25.