This should be easy but I must be missing something obvious. I have the following PowerPivot table:
Level 1 Level 2 Amount
------- ------- ------
A X 100
A Y 200
B X 400
B Y 600
I'm trying to build a measure (not a calculated column) that iterates over each item in Level 2 and divides the amount by the subtotal of all amounts for Level 1 equal to the current Level 1 amount.
In other words, I want the measure to do this
Level 1 Level 2 Measure
------- ------- ------
A X 100 / 300
A Y 200 / 300
B X 400 / 1,000
B Y 600 / 1,000
I have tried this:
AmountSum:=SUM(Table1[Amount])
Measure:= SUMX(Table1,
[AmountSum]/CALCULATE(SUMX(Table1, [AmountSum]), ALL(Table1[Level 2])))
This and other iterations I've tried always end up showing 1 for each calc meaning that (or so it appears) only the initial Level 2 row is in scope when calc'ing the denominator, despite my use of ALL.
Thanks in advance for any advice people can offer!
Edit: Assume that the [AmountSum] logic is dependent on and needs to be calculated at the row level for the Level 2 items. It was simplified in the example above, but in reality it is dependent on the Level 2 data and at a Level 1 level should only be adding up results calculated at a Level 2 level.