SUMX DAX Function in Power BI

The SUMX function in DAX is an iterator that evaluates an expression for every row in a table and then sums the results. Unlike the standard SUM function, which only works on a single column, SUMX allows you to perform complex, multi-column calculations (like Price * Quantity) at the row level before aggregating the total. This is essential for accurate financial reporting and advanced data modeling.

DAX Syntax SUMX(table, expression)

The function has the following parameters:

How it Works: Row Context

SUMX creates a Row Context. It goes through the table row-by-row, calculates the expression, stores that value in temporary memory, and finally adds all those stored values together.

Example: Create a measure.

DAX

Sumx value = SUMX(FILTER(Sheet1, [10th Marks]>400), [10th Marks])

This DAX expression calculates the sum of the "10th Marks" column in "Sheet1", but only for rows where the "10th Marks" are greater than 400.

The output of the above measure can be shown in the card visual as shown in the image below.

SUMX DAX function in Power BI

SUM vs. SUMX

FeatureSUMSUMX
TypeAggregatorIterator
ScopeSingle Column OnlyMulti-column / Expressions
ContextFilter ContextRow Context (within iteration)
PerformanceExtremely FastCan be slower on massive tables

Performance Best Practice

Note: If you only need to sum a single column without any filters or complex math, use SUM. It is optimized at the engine level. Use SUMX only when row-level logic or pre-filtering is required.