Short answer: show the median when a few very big or very small values could pull the number away from what is typical: order values, salaries, delivery times, house prices. Show the average (the mean) when every value should count by its size, like total cost per order across a budget. If the two are far apart, your data is skewed, and the median is the better "typical" value. In DAX they are MEDIAN and AVERAGE.
A box plot is built around the median for a reason: it is the middle value, and one outlier cannot move it. A KPI card that shows only the average can hide that most customers wait two days while a few wait three weeks.
How far can one value move the average?
Nine support tickets, closed in hours:
The average is (2 + 3 + 3 + 4 + 4 + 5 + 5 + 6 + 48) ÷ 9 = 80 ÷ 9 = 8.9 hours. The median, the fifth of nine sorted values, is 4 hours. Eight of the nine tickets closed in 6 hours or less, so "typically about 4 hours" is the honest summary, and the one slow ticket deserves its own look.
When is the average the right number?
| Question | Use | Why |
|---|---|---|
| What does a typical customer wait? | Median | One very slow case should not move "typical" |
| What is the typical order value? | Median | A few huge orders pull the average up |
| What does each order cost us on average, to plan the budget? | Average | Every euro counts, the big ones too |
| What is the average daily revenue this month? | Average | Totals divided by days, used to forecast |
A good rule: if you would multiply the number back up to a total, use the average. If you want to describe one typical item, use the median.
How do you write them in DAX?
Avg Hours = AVERAGE ( Tickets[HoursToClose] )
Median Hours = MEDIAN ( Tickets[HoursToClose] )Both respect the filters on the page, so a slicer for a team gives that team's median. To compute over a measure per item instead of a column, use the iterator versions AVERAGEX and MEDIANX.
What goes wrong?
- Only the average on the card. Show both, or the median with the average in the tooltip, when the data is skewed.
- Deleting the outlier to fix the average. The 48-hour ticket is real; report the median and investigate the ticket.
- Averaging averages. The average of five store averages is not the company average when stores differ in size.
Where can you check this?
- Microsoft Learn: MEDIAN function (DAX)
- Microsoft Learn: AVERAGE function (DAX)
- NIST/SEMATECH e-Handbook of Statistical Methods: Measures of location
Where do you start?
To see the whole spread instead of one number, see what is a histogram and AVERAGEX, MINX and MAXX. All statistical functions are in the DAX statistical functions reference.