The function SUMX has two arguments – a table and expression. The table parameter references a named table in a data model, while the expression completes a specified calculation row by row.
SUMX is an iterator function, because it iterates through all the rows in a table and calculates the expression for every single row.
Take a look at the example from the video:
Sales = SUMX (SalesTable, SalesTable[Price] * SalesTable [Quantity] )
The easy way to understand this function is to think of it as a two-step process. The first step multiplies each row of the column [Price] by a corresponding row in the column [Quantity]. Then it temporarily stores the preliminary results in the backend memory.
In the second step, the function sums up the preliminary results, giving you a total.
If you’re using COUNTX or AVERAGEX, then obviously the second step will be counting or averaging. Watch our short tutorial with a clear example to understand the power of the SUMX function.
#PowerBI #DAX #SUMX