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.
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
Median(OrderValue)
Median(Aggr(Sum(Sales), Customer))
Stdev(Sales)
Mode(Product)Power BI equivalent
Median and standard deviation (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)
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, notSTDEV.P. Qlik'sStdevdivides by n-1, and onlySTDEV.Pdivides by n. Modecounts rows where the value occurs. If your Qlik expression wasMode(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
- Median - chart function (Qlik Help)
- Mode - chart function (Qlik Help)
- Stdev - chart function (Qlik Help)
- MEDIANX function (DAX) (Microsoft Learn)
- STDEV.S function (DAX) (Microsoft Learn)
Related pages
Fractile(Sales, 0.9)
Fractile (percentiles)
Fractile() is inclusive and interpolates between values, which is the same method as DAX PERCENTILE.INC. FractileExc() matches PERCENTILE.EXC. For a percentile over an aggregated grain (Fractile with Aggr), use PERCENTILEX.INC over a table of groups.
Direct equivalent
Avg(Aggr(Sum(Sales), Customer))
Aggr (nested aggregation)
Aggr builds a virtual table of aggregated values, for example sales per customer, so you can aggregate again. In DAX that is an iterator (AVERAGEX, MAXX, COUNTROWS(FILTER(...))) over VALUES or SUMMARIZE that calls a measure.
Partial / different approach
FirstSortedValue(Product, -Aggr(Sum(Sales), Product))
FirstSortedValue
FirstSortedValue returns the value of one field on the record with the lowest (or, with a minus sign, highest) sort weight, such as the top-selling product or the latest status. In DAX, use TOPN plus a tie check, or LASTNONBLANKVALUE for "latest".
Partial / different approach
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.