MDX - Add Calculated Percent Measure into a Range

90 Views Asked by At

i didn't found any solution for my problem. Or maybe i dont know the right keywords.

Problem: Cube contains a calculated member measure:

CREATE MEMBER CURRENTCUBE.[Measures].[Percentage] as
iif([Measures].[Performance GB]=0, null,
    [Measures].[Performance GB]/[Measures].[Package GB]),
FORMAT_STRING = "0#.#0 %;-#.#0 %", 
VISIBLE = 1;   

Now i need another attribute to group the percent values into a range. My first idea was this member with 4 additional measures. For example:

create MEMBER CURRENTCUBE.[Measures].[0-25%] AS 
IIF(
 [Measures].[Percentage]>0 AND [Measures].[Percentage]<26
,1
,NULL),VISIBLE = 1; 

It works if i show the values on the contract level.

But a deeper watch shows wrong values: CubeSelection

Whats my error?

2

There are 2 best solutions below

0
NimraF On BEST ANSWER

My first idea was the wrong way. The solution is a calucalted field to generate the DimensionKey

when (PerformanceGB/ServiceGB)*100 between  0 and 11 then 1
when (PerformanceGB/ServiceGB)*100 between 11 and 21 then 2
....

And then i could use the PercentRange as a Dimension

0
whytheq On

Can you try changing 26 to 0.26?

create MEMBER CURRENTCUBE.[Measures].[0-25%] AS IIF( [Measures].[Percentage]>0 AND [Measures].[Percentage]<0.26 ,1 ,NULL),VISIBLE = 1;