Percent of parent at every level of a matrix with ISINSCOPE
One measure that shows each product’s share of its category and each category’s share of the total in a two-level matrix.
You will learn to
- Pick the right parent for each level of a matrix
- Remove only one level’s filter with REMOVEFILTERS
- Combine levels with SWITCH(TRUE()) and a variable
How it works
“Percent of parent” means something different on each level of a matrix:
- on a **product** row: the product’s share of its category; - on a **category** row: the category’s share of the grand total; - on the **grand total**: 100%.
Each parent is the same `[Total Sales]` with **one** level’s filter removed. On a product row, removing the Product filter leaves the Category filter, which is exactly the category total. On a category row, removing the Category filter gives the grand total. `REMOVEFILTERS(column)` inside CALCULATE does that.
Use ISINSCOPE to decide which level you’re on, deepest first, and store `[Total Sales]` in a variable so it is calculated once.
Practice it hands-on with a real data model and a live report that updates as you type.
Share of Region =
IF(ISINSCOPE(Customer[Customer]), DIVIDE([Total Sales], CALCULATE([Total Sales], REMOVEFILTERS(Customer[Customer]))))