SUMX Works Row by Row
Part of the DAX with CALCULATE section of Coddy's Power BI journey. Lesson 12 of 24.
SUMX(Table, expression) works out the expression on each row, then adds the results.
Gross Sales = SUMX(Sales, Sales[Quantity] * Sales[UnitPrice])Each row multiplies its own quantity and price. Nothing is stored.
Multiplying two SUMs is not the same: it multiplies totals.
Challenge
What would sales be at list price, before the member discount? Write Gross Sales: the sum of quantity times unit price, line by line. It is checked for each category.
All lessons in DAX with CALCULATE
3Row by Row in a Measure
SUMX Works Row by RowAVERAGEX and MAXXFILTER Picks RowsMeasures Inside IteratorsRanking with RANKXRecap - Profit Without Columns