Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Percentage measure in cube

Status
Not open for further replies.

ThorstenBla

Programmer
Apr 16, 2004
1
0
0
DE
Hi,

I´m a newbie in MDX.
I want to create a calculated member which shows the percentage allocation of a measure. I use the following code:

CREATE MEMBER [myCube].[Measures].ZM1 AS
'(Dim1.CurrentMember, [Measures].ZM1perc) / (Dim1.CurrentMember.parent, [Measures].ZM1perc)'

With only one dimension everything is OK. But with more than one dimension, the value of "(RD1.CurrentMember.parent, [Measures].ZM1perc)" is wrong starting with the second dimension.

My goal is to display the results in one of two different ways (or better, both of them, making the behaviour configurable):

1.
In this case the percentage values for the members in the 2nd dimension refer to the total data set:

Dim1- Value
M1 - - 30%
M2 - - 60%
M3 - - 10%
--------------------------- expand M1
Dim1 Dim2 - Value
M1 - - B1 - - 10%
M1 - - B2 - - 15%
M1 - - B3 - - 05%
M2 - - B4 - - 30%
... ... ...

2.
In this case the percentage values for the members in the 2nd dimension would refer to the data set represented by the parent member, interpreting the parent member value as 100%. An example would be:

Dim1 Value
M1 - - 30%
M2 - - 60%
M3 - - 10%
--------------------------- expand M1
Dim1 Dim2 - Value
M1 - - B1 - - 23%
M1 - - B2 - - 60%
M1 - - B3 - - 12%
M2 - - B4 - - 30%
... ... ...

Any ideas how I can do this?

Regards,
Thorsten Blawatt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top