Sales commission by category with SUMX, RELATED and IF

Pay a different commission rate per product category by deciding the rate row by row inside SUMX.

You will learn to

  • Choose a rate per row with IF inside SUMX
  • Read a related column with RELATED
  • Explain why the total must be calculated row by row

How it works

Many business rules depend on **what** was sold: a commission rate, a tax rate, a shipping charge. When the rate changes from row to row, you can’t multiply a total by one number. You need to decide the rate for each sale first.

Inside `SUMX(Sales, …)` you are on one order line at a time. `RELATED(Product[Category])` reads that line’s category from the Product table, and `IF(condition, a, b)` picks a value based on it.

Multiply each line’s amount by its own rate and let SUMX add the results. Every subtotal, including the grand total, is then a true mix of the rates.

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

Shipping Charge = SUMX(Sales, Sales[Quantity] * IF(RELATED(Product[Category]) = "Bikes", 40, 3))