I'm trying to design a calculation in a cube's MDX calculation so that when a specific value of a dimension is used, the behavior/values returned by the measure is change to something else, based on other values from the same dimension attribute.
here's my code sample :
CREATE SET CURRENTCUBE.[NonBreakDownIndicators]
AS {([Indicator Label].[Indicator].MEMBERS - [Indicator Label].[Indicator].&[Indicator Daily Diff])}
;
SCOPE([Measures].[Value Unit], [Indicator Label].[Indicator].&[Indicator Daily Diff]);
//SCOPE([NonBreakDownIndicators]);
THIS = ([Indicator Label].[Indicator].&[SensiDiv],[Measures].[Daily Diff Unit]);
//THIS = [Measures].[Daily Diff Unit];
//END SCOPE;
END SCOPE;
What we can see here is that I want to create a tuple with some dimension 'Indicator' values, except one. I have 3000+ values in this dimension attribute.
Next, when a user select, among others, the attribute Indicator, and among the selected values, one is 'Indicator Daily Diff', I want to change the values returned by the measure 'Value Unit', to instead get the values from 'Daily Diff Unit'.
This last measure is tested and working.
So far I've managed to get a result with the currently uncommented code. But as you can see this will only work for 1 value of the 'Indicator' dimension, when I would need to make it work for thousands of them.
I've tried to use a sub scope as you can see in the commented code, but I get this exception :
An arbitrary shape of sets is not allowed in the current context.
I've also tried to use the Tuple set [NonBreakDownIndicators] in the THIS statement like this :
SCOPE([Measures].[Value Unit], [Indicator Label].[Indicator].&[Indicator Daily Diff]);
THIS = ([NonBreakDownIndicators],[Measures].[Daily Diff Unit]);
END SCOPE;
But then I would end up with a 'null' value in my cube (not empty or not showing, a cell is filled with null).
I'm not SSAS expert and I'm mostly doing stuff hoping to get some keywords to look up, but so far internet blogs have had little infos on my topic, and I can find anyone around me with enough knowledge on this technology.
Does anyone have an idea about how I could achieve this without having to specify every single Indicator the MDX?
PS: I can't use a measure to solve this. My client explicitely asked for this 'Daily Diff Unit' to be shown as indicator, in order to have only one measure, and as many indicator as they need.
Edit
I did this change and indeed it resolve the 'arbitrary shape of sets' error. But now I don't get any figure back when querying.
I can see other figures on other 'Indicators', but no cell is returned for the [Indicator Daily Diff] indicator. I'm using this right now :
CREATE SET CURRENTCUBE.[NonBreakDownIndicators]
AS {([Indicator Label].[Indicator].[Indicator].MEMBERS - [Indicator Label].[Indicator].&[Indicator Daily Diff])}
;
SCOPE([Measures].[Value Unit], [Indicator Label].[Indicator].&[Indicator Daily Diff]);
SCOPE([NonBreakDownIndicators]);
THIS = ([NonBreakDownIndicators],[Measures].[Daily Diff Unit]);
END SCOPE;
END SCOPE;