Short answer: DAX aggregation functions come in three forms. The plain form takes a column (SUM ( Sales[Amount] )). The X form is an iterator that evaluates an expression per row of a table and then aggregates (SUMX ( Sales, Sales[Qty] * Sales[Price] )). The A form (AVERAGEA, MINA, MAXA, COUNTA) also handles non-numeric values such as Booleans. Most return BLANK when there are no rows, which keeps empty rows out of visuals.
This page lists all of them with one example each. The everyday ones have their own posts: SUM vs SUMX, count functions, AVERAGEX, MINX and MAXX.
Which functions sum and multiply?
| Function | Does | Example |
|---|---|---|
| SUM | adds the numbers in a column | SUM ( Sales[Amount] ) |
| SUMX | adds an expression evaluated per row | SUMX ( Sales, Sales[Quantity] * Sales[Unit Price] ) |
| PRODUCT | multiplies the numbers in a column | PRODUCT ( Growth[Factor] ) |
| PRODUCTX | multiplies an expression evaluated per row | PRODUCTX ( Returns, 1 + Returns[Monthly Return] ) - 1 |
PRODUCTX is the function for compound growth: a month of +10% followed by a month of -10% compounds to 1.10 * 0.90 - 1, which is -1%, while adding the two rates says 0%.
Compound Return =
PRODUCTX ( VALUES ( 'Date'[Month] ), 1 + [Monthly Return] ) - 1Which functions average?
| Function | Does | Example |
|---|---|---|
| AVERAGE | mean of the numbers in a column | AVERAGE ( Sales[Amount] ) |
| AVERAGEA | mean, counting TRUE as 1, FALSE and text as 0 | AVERAGEA ( Survey[Recommends] ) |
| AVERAGEX | mean of an expression per row | AVERAGEX ( VALUES ( 'Date'[Month] ), [Revenue] ) |
For medians, percentiles and geometric means see the statistical functions.
Which functions find the smallest and largest?
| Function | Does | Example |
|---|---|---|
| MIN | smallest value in a column, or the smaller of two values | MIN ( Sales[Order Date] ) |
| MINA | as MIN, also for Booleans (FALSE is 0) | MINA ( Tasks[Done] ) |
| MINX | smallest result of an expression per row | MINX ( VALUES ( 'Date'[Month] ), [Revenue] ) |
| MAX | largest value in a column, or the larger of two values | MAX ( [Revenue], [Target] ) |
| MAXA | as MAX, also for Booleans (TRUE is 1) | MAXA ( Tasks[Done] ) |
| MAXX | largest result of an expression per row | MAXX ( VALUES ( Sales[Order ID] ), [Revenue] ) |
Which functions count?
| Function | Counts | Example |
|---|---|---|
| COUNT | non-blank numbers, dates and strings | COUNT ( Sales[Ship Date] ) |
| COUNTA | non-blank values, also Booleans | COUNTA ( Sales[Is Return] ) |
| COUNTAX | rows where an expression returns any non-blank value | COUNTAX ( Sales, Sales[Comment] ) |
| COUNTBLANK | blank cells in a column | COUNTBLANK ( Sales[Ship Date] ) |
| COUNTROWS | rows of a table | COUNTROWS ( Sales ) |
| COUNTX | rows where an expression is not blank | COUNTX ( VALUES ( 'Product'[Product] ), [Revenue] ) |
| DISTINCTCOUNT | unique values, BLANK as one | DISTINCTCOUNT ( Sales[Customer Key] ) |
| DISTINCTCOUNTNOBLANK | unique values without BLANK | DISTINCTCOUNTNOBLANK ( Sales[Promo Code] ) |
| APPROXIMATEDISTINCTCOUNT | an estimate of unique values (large DirectQuery sources) | APPROXIMATEDISTINCTCOUNT ( Events[User ID] ) |
How do you choose between plain and X?
| If | Use |
|---|---|
| the value is already a column | plain: SUM, AVERAGE, MAX |
| the value must be computed per row | X: SUMX ( Sales, Qty * Price ) |
| the average or max is per group (month, customer) | X over the group: AVERAGEX ( VALUES ( 'Date'[Month] ), [Revenue] ) |
| the total must add up the rows of the visual | X over the row column: SUMX ( VALUES ( Customer[Customer] ), [Bonus] ) |
What goes wrong?
- Multiplying or dividing aggregates where the row math is needed.
SUM ( Qty ) * SUM ( Price )is not revenue. - Average of a ratio column. Average the parts, then divide.
- X functions over a fact table with a measure inside. Slow; iterate the dimension.
- Expecting 0. Most return BLANK with no rows; see BLANK handling.
Where can you check this?
- Microsoft Learn: Aggregation functions (DAX)
- Microsoft Learn: PRODUCTX function (DAX)
- Microsoft Learn: AVERAGEA function (DAX)
Where do you start?
Keep this page for lookup, and learn SUM, SUMX, DISTINCTCOUNT, COUNTROWS and AVERAGEX well; they cover nearly every measure. The filter functions decide what rows these functions see.