I am trying to make a calculated measure in my cube that will be different depending on which date dimension is shown. I thought SCOPE
was going to get me what I wanted but it seems to do a last pass calculation.
CREATE MEMBER CURRENTCUBE.[Measures].[Sales Prior]
AS (
Null
),
VISIBLE = 1 , ASSOCIATED_MEASURE_GROUP = 'Sales';
SCOPE ([Sales and Forecast Date].[Calendar Year].Members, [Measures].[Sales Prior]);
this = ([Sales and Forecast Date].[Calendar Year].CurrentMember.PREVMEMBER, [Measures].[Sales Amount]);
end scope;
SCOPE ([Sales Requested Ship Date].[Calendar Year].Members, [Measures].[Sales Prior]);
this = ([Sales Requested Ship Date].[Calendar Year].CurrentMember.PREVMEMBER, [Measures].[Sales Amount]);
end scope;
SCOPE ([Sales Ship Date].[Calendar Year].Members, [Measures].[Sales Prior]);
this = ([Sales Ship Date].[Calendar Year].CurrentMember.PREVMEMBER, [Measures].[Sales Amount]);
end scope;
This code snippet only works on the Ship Date dimension and givesNULL
for the other 2.
I also tried nesting the SCOPE
statements but it did the same thing.