Table of contents
TOC
Collapse the table of content
Expand the table of content

SUMX Function (DAX)

Owen Duncan|Last Updated: 4/19/2018

Returns the sum of an expression evaluated for each row in a table.

Syntax

SUMX(<table>, <expression>)  

Parameters

TermDefinition
tableThe table containing the rows for which the expression will be evaluated.
expressionThe expression to be evaluated for each row of the table.

Return Value

A decimal number.

Remarks

The SUMX function takes as its first argument a table, or an expression that returns a table. The second argument is a column that contains the numbers you want to sum, or an expression that evaluates to a column.

Only the numbers in the column are counted. Blanks, logical values, and text are ignored.

To see some more complex examples of SUMX in formulas, see ALL Function (DAX) and CALCULATETABLE Function (DAX).

Example

The following example first filters the table, InternetSales, on the expression, ShippingTerritoryID = 5, and then returns the sum of all values in the column, Freight. In other words, the expression returns the sum of freight charges for only the specified sales area.

=SUMX(FILTER(InternetSales, InternetSales[SalesTerritoryID]=5),[Freight])  

If you do not need to filter the column, use the SUM function. The SUM function is similar to the Excel function of the same name, except that it takes a column as a reference.

See Also

SUM Function (DAX)
Statistical Functions (DAX)

© 2018 Microsoft