DAX SUM Function
The bedrock aggregator for numerical columns in Power BI.
SUM( Table[Column] )Overview
SUM adds all numbers in a column. It automatically respects the current filter context set by slicers, rows, columns, and visual filters.
The SUM function accepts a single column reference. It cannot evaluate arithmetic expressions (like Price * Quantity) inside its arguments—for row-by-row math, use SUMX instead. Under the hood, SUM is optimized by Microsoft VertiPaq and operates directly against compressed columnar storage.
Total Revenue =
SUM(Sales[Revenue])When to use SUM
- Adding up a numeric column that already holds the value you want, such as Sales[Amount] or Inventory[Units].
- As the base measure that other measures (ratios, time intelligence, comparisons) build on.
- Whenever no row-by-row arithmetic is needed — if you need Quantity × Price per row first, use SUMX.
Worked examples
A base measure to reuse everywhere
Total Sales =
SUM ( Sales[Amount] )
Sales LY =
CALCULATE ( [Total Sales], SAMEPERIODLASTYEAR ( 'Date'[Date] ) )Define the SUM once as a measure and reference the measure everywhere else. If the definition of sales changes (say, to exclude returns), you change one measure instead of twenty.
SUM with a filter
Online Sales =
CALCULATE ( SUM ( Sales[Amount] ), Sales[Channel] = "Online" )SUM itself has no filter argument; wrap it in CALCULATE to change the filter context. The Channel filter is applied on top of whatever slicers and visual filters are active.
Common mistakes
- Passing an expression instead of a column (e.g., SUM(Sales[Qty] * Sales[Price]) will cause a syntax error; use SUMX instead).
- Using SUM in calculated columns when you intend dynamic report visual behavior.
- Attempting to sum text or boolean values.
Performance notes
SUM over a single column is one of the cheapest operations in DAX: the storage engine aggregates the compressed column directly, in parallel, without involving the formula engine row by row. Performance problems attributed to SUM are almost always caused by the filters around it or by the model (very large or high-cardinality columns), not by SUM itself.
Frequently asked questions
- What is the difference between SUM and SUMX in DAX?
- SUM adds up one column. SUMX iterates a table, evaluates an expression for each row, and adds up the results — so it can handle per-row arithmetic like Quantity × Price. SUM(Sales[Amount]) is internally the same as SUMX(Sales, Sales[Amount]).
- Why does my SUM measure show the same number on every row?
- The visual's rows are not filtering the table the SUM reads from — usually because there is no relationship, or the relationship filters in the wrong direction. Check that the column on the rows comes from a dimension related to the fact table you are summing.
- Should I use SUM in a calculated column?
- Rarely. In a calculated column, SUM evaluates without the row's filter context (unless wrapped in CALCULATE) and returns the grand total on every row. Aggregations usually belong in measures.