I'm trying to build up a Calculated Column that calculates the Average Price (so I can calculate the deviation of each row from that average) across the sub-set of rows that have the same ProductID, YearID and ChannelID as the current row-context.

First, I tested the formula below using a fixed value, before going on to replace it with a variable for the current row-context. However, this syntax returns the price of the current row i.e. It is calculating the average of the current row...rather than all rows with the same IDs.

Anyone help, and then help me generalise it so it works for all IDs? I tried using All(Table) but that overrides the other ID filter expressions.
What am I missing?

In an MDX context, this would be the deviation of the child from it's siblings within a parent effectively.


I will then have Table[Price] - Average[Price] for every row based on it's siblings