| 1. |
Explain When Do You Use Sumx() Instead Of Sum()? |
|
Answer» When the expressions to SUM() consits of anything else than a column name. Typically when you want to add or MULTIPLY the values in different columns: SUMX(Orderline, Orderline[quantity], Orderline[price]) SUMX() first creates a ROW CONTEXT over the Sales table (see 1 above). It then iterates through this table one row at a time. SUM() is optimized for reducing over column segments and is as such not an ITERATOR. When the expressions to SUM() consits of anything else than a column name. Typically when you want to add or multiply the values in different columns: SUMX(Orderline, Orderline[quantity], Orderline[price]) SUMX() first creates a row context over the Sales table (see 1 above). It then iterates through this table one row at a time. SUM() is optimized for reducing over column segments and is as such not an iterator. |
|