Row-by-row math with SUMX and RELATED

Calculate list-price revenue by multiplying quantity by a price that lives in another table.

You will learn to

  • Explain when SUM is not enough
  • Iterate a table with SUMX
  • Fetch a value from a related table with RELATED

How it works

`SUM` can only add up one existing column. When you need to calculate something **for each row first**, use an iterator: `SUMX(table, expression)` works out the expression for every row of the table, then adds the results.

Inside `SUMX(Sales, …)` you are “on” one Sales row at a time, so `Sales[Quantity]` means *this row’s* quantity.

The list price is in a different table, `Product`. `RELATED(Product[Price])` follows the relationship from the current sale to its product.

Practice it hands-on with a real data model and a live report that updates as you type.

Discount Given = SUMX(Sales, Sales[Quantity] * RELATED(Product[Price]) * Sales[Discount])