Short answer: DAX statistical functions describe spread and position (MEDIAN, PERCENTILE.INC, STDEV.S, VAR.S, GEOMEAN), fit lines (LINEST, LINESTX), work with distributions (NORM.DIST, T.INV, CHISQ.DIST, POISSON.DIST), give confidence intervals (CONFIDENCE.T), sample tables (SAMPLE) and count combinations (COMBIN, PERMUT). Most come in two forms: on a column (MEDIAN) and as an iterator over a table and an expression (MEDIANX). .S means sample, .P means population.
The average hides as much as it shows. A median order value next to the mean, or the 90th percentile of delivery time, tells readers what a typical customer experiences.
Which functions describe spread and position?
| Function | Column form | Iterator form | Example |
|---|---|---|---|
| median | MEDIAN | MEDIANX | MEDIANX ( VALUES ( Orders[Order ID] ), [Order Value] ) |
| percentile, k from 0 to 1 | PERCENTILE.INC, PERCENTILE.EXC | PERCENTILEX.INC, PERCENTILEX.EXC | PERCENTILE.INC ( Delivery[Days], 0.9 ) |
| standard deviation | STDEV.S, STDEV.P | STDEVX.S, STDEVX.P | STDEVX.S ( VALUES ( 'Date'[Date] ), [Revenue] ) |
| variance | VAR.S, VAR.P | VARX.S, VARX.P | VAR.P ( Sales[Amount] ) |
| geometric mean | GEOMEAN | GEOMEANX | GEOMEANX ( Years, 1 + [Growth %] ) - 1 |
| rank of a value | RANK.EQ | RANKX | RANK.EQ ( Sales[Amount], Sales[Amount], DESC ) |
.INC includes the ends (k from 0 to 1); .EXC excludes them. Use .S when the rows are a sample of a larger group, .P when they are all of it.
-- typical and worst-case delivery
Median Days = MEDIAN ( Delivery[Days] )
P90 Days = PERCENTILE.INC ( Delivery[Days], 0.9 )
-- daily revenue volatility in the selection
Daily Revenue StDev = STDEVX.S ( VALUES ( 'Date'[Date] ), [Revenue] )Microsoft notes that MEDIAN over an integer column can return integer or double, so a calculated column may need CONVERT ( ..., DOUBLE ) to keep one type.
How do you fit a trend line?
LINESTX ( table, y, x1 [, x2, ...] ) returns a one-row table with Slope1, Intercept, CoefficientOfDetermination (r²), StandardError, FStatistic and more:
Revenue Trend =
VAR Fit =
LINESTX ( ALLSELECTED ( 'Date'[Month Index] ), [Revenue], 'Date'[Month Index] )
VAR Slope = SELECTCOLUMNS ( Fit, [Slope1] )
VAR Intercept = SELECTCOLUMNS ( Fit, [Intercept] )
RETURN Intercept + Slope * MAX ( 'Date'[Month Index] )
Trend R2 =
SELECTCOLUMNS (
LINESTX ( ALLSELECTED ( 'Date'[Month Index] ), [Revenue], 'Date'[Month Index] ),
[CoefficientOfDetermination]
)LINEST takes columns of one table; LINESTX takes any expressions, which is what measures need. Months as an index (1, 2, 3, ...) keep the slope readable: revenue change per month.
Which distribution functions are there?
| Family | Functions | Example |
|---|---|---|
| normal | NORM.DIST, NORM.INV, NORM.S.DIST, NORM.S.INV | NORM.S.INV ( 0.975 ) = 1.96 |
| Student's t | T.DIST, T.DIST.2T, T.DIST.RT, T.INV, T.INV.2T | T.INV.2T ( 0.05, 20 ) = 2.086 |
| chi-squared | CHISQ.DIST, CHISQ.DIST.RT, CHISQ.INV, CHISQ.INV.RT | CHISQ.DIST.RT ( 6.2, 2 ) = 0.045 |
| beta | BETA.DIST, BETA.INV | BETA.DIST ( 0.4, 2, 3, TRUE ) |
| Poisson | POISSON.DIST | POISSON.DIST ( 2, 3, FALSE ) = 0.224 |
| exponential | EXPON.DIST | EXPON.DIST ( 1, 0.5, TRUE ) = 0.393 |
Which functions give confidence and samples?
-- 95% confidence interval for the mean order value
CI Half Width =
CONFIDENCE.T ( 0.05, STDEV.S ( Orders[Value] ), COUNTROWS ( Orders ) )
-- 100 customers spread evenly over the key order, for a scatter chart
Customer Sample = SAMPLE ( 100, VALUES ( Customer[Customer Key] ), Customer[Customer Key] )SAMPLE ( n, table, orderBy ) returns n rows spread evenly over the order, including the first and last; Microsoft advises grouping the table by the sort column to avoid duplicates. COMBIN ( 10, 3 ) is 120 ways to pick 3 of 10; PERMUT ( 10, 3 ) is 720 when order matters; COMBINA allows repeats.
In depth: error bars and confidence.
What goes wrong?
- Mean when the data is skewed. Order values and delivery times have long tails; report the median and a percentile.
- .S against .P. Small groups show the difference; pick by whether the rows are all of the population.
- Iterating the wrong grain.
STDEVX.S ( Sales, ... )gives line-level spread; iterateVALUES ( 'Date'[Date] )for daily spread. - Trend on dates. Slopes per day on date serial numbers are tiny and hard to read; use a month index.
Where can you check this?
- Microsoft Learn: Statistical functions (DAX)
- Microsoft Learn: LINESTX function (DAX)
- Microsoft Learn: SAMPLE function (DAX)
Where do you start?
Add Median Days and P90 Days next to the average in your delivery or response-time report. Financial functions handle loans, depreciation and returns.