I need to create a calculated measure Internal Quantity
for the following equation,
Internal quantity = Quantity where [X].[Category Id] = A or B/ Quantity
The calculated measure Quantity
calculates the SUM of a column. So, for example if the values for [X].[Category Id].&[A] = 50
and [X].[Category Id].&[A] = 20
and the Quantity = 100
, the Internal Quantity
should be 0.5 and 0.2 respectively.
I have written the following MDX expression to achieve this,
Case [X].[Category Id]
When [X].[Category Id].&[A] Then [X].[Category Id].&[A]/[Measures].
[Quantity]
When [X].[Category Id].&[B] Then [X].[Category Id].&[B]/[Measures].
[Quantity]
else NULL
End
However with the above expression both the [X].[Category Id].&[A]
and [Measures].[Quantity]
return the same value probably as they are inside a case statement.
I would really appreciate any help with this. Thanks in advance!