Answer the question
In order to leave comments, you need to log in
[SSAS] Generic calculation measure (perhaps using a stored procedure)?
What to achieve
There are dimensions [D1], [D2], [D3] and measure [M].
Each dimension is related to [M] as many-to-many.
I need to create a generic measure with the formula [M] / S( [M] ), where S is the sum of all measure facts associated with at least one member of the current dimension (current = used in the MDX query).
What I tried
S( [M] ) can be given as a calculated measure using MDX:
CREATE HIDDEN [Total M] =
AGGREGATE(
DESCENDANTS(
AXIS( 1 ).ITEM( 0 ).DIMENSION.LEVELS( 0 ).ITEM( 0 ),
AXIS( 1 ).ITEM( 0 ).DIMENSION.LEVELS.COUNT
) - AXIS( 1 ).ITEM( 0 ).DIMENSION.LEVELS( 0 ).ITEM( 0 ),
[Measures].[M]
);
CREATE MEMBER CURRENTCUBE.[Measures].[Share of M] AS
[Measures].[M] / [Measures].[Total M]
SELECT [Measures].[Share of M] ON 0,
ORDER( [D1].MEMBERS, [Measures].[Share of M] ) ON 1
FROM [MyCube]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question