I have two dimensions A,B and a measure M which is aggregated by summing.

If I would apply both dimensions I could get a table that might look as follows:


Now the problem I am facing is that I would like to sum column-wise (or row-wise) so I can calculate the column-wise ratio of a value:


I tried expressions like [Measures].[M] / SUM([Measures].[M]) or [Measures].[M] / ([All], [Measures].[M]) - to no avail.

I would like to add that the formula should by dynamic and not use a specific drill down.
Expressed in words - the denominator should be the sum of the measure if the drill down would lack the last step.

I'm using Mondrian 4.6 BTW.

Kind regards