SUM
The sum of a column's numbers.
Group: Aggregation. Compatible with DAX.
Syntax
SUM ( <column> )
| Parameter | Type | Description |
|---|---|---|
column | Column | A column of numbers. |
Returns
Number. The total of the column's values in the current filter context.
Remarks
- Blank cells are left out. When nothing is left to add, the result is BLANK rather than 0.
- Text in the column makes the call fail.
- SUM takes one column. To add an expression of several columns, use
SUMX:SUMX ( Sales, Sales[Liters] * RELATED ( Products[Price per liter] ) ). - In a measure, the filter context decides which rows are added: in a visual by product, each product's own rows.
Examples
All liters sold
EVALUATE
ROW ( "Liters sold", SUM ( Sales[Liters] ) )
| Liters sold |
|---|
| 1806463 |
Liters by product
EVALUATE
SUMMARIZECOLUMNS (
Sales[Product],
"Liters", SUM ( Sales[Liters] )
)
ORDER BY Sales[Product]
| Sales[Product] | Liters |
|---|---|
| Cider | 301074 |
| IPA | 331884 |
| Lettøl | 169179 |
| Pils | 1004326 |
Blanks are left out
Two of the five holdings have no price: the sum is of three.
EVALUATE
ROW ( "Sum of prices", SUM ( Holdings[Price] ) )
| Sum of prices |
|---|
| 291.29 |