If our time dimension was indeed hierarchical, I would define the metric as follows:
([Time].[Currentmember], [Measures].[Sales] - ([Time].[CurrentMember].[PrevMember], [Measures].[Sales])
Right now, I have only been able to do it for a specific level whether it's year, quarter or month. For example, for a year over year growth, I've defined it as follows:
([Date].[Year].CURRENTMEMBER, [Measures].[Sales USD]) -
([Date].[Year].CURRENTMEMBER.PREVMEMBER, [Measures].[Sales USD])
If I wanted to do the same for months, I'd replace "Year" with "Month" as follows:
([Date].[Month].CURRENTMEMBER, [Measures].[Sales USD]) -
([Date].[Month].CURRENTMEMBER.PREVMEMBER, [Measures].[Sales USD])
Is it possible to do a dynamic period over period growth in 1 calculated member based on how our Date dimension is setup?
Could you explain what attribute relations exist in your time dimension - are quarters related to months, and years to quarters? Or is the [Month] like a "month-of-year" and quarter like a "quarter-of-year"? In that case, you could try a scoped assignment like:
Create [Measures].[SalesGrowth];
Scope([Measures].[SalesGrowth]);
Scope([Date].[Year].[Year]);
this = [Measures].[Sales USD] - ([Date].[Year].PREVMEMBER, [Measures].[Sales USD]);
Scope([Date].[Quarter].[Quarter]);
this = [Measures].[Sales USD] - ([Date].[Quarter].PREVMEMBER, [Measures].[Sales USD]);
Scope([Date].[Month].[Month]);
this = [Measures].[Sales USD] - ([Date].[Month].PREVMEMBER, [Measures].[Sales USD]);
End Scope;
End Scope;
End Scope;
End Scope;
|||Deepak,I've never used SCOPE before, but this looks like it could work. Where do I use SCOPE? In the definition of the [SalesGrowth] calculated member? Or do I have to somehow make use of a new SCRIPT command? I've never done this either. The only Script Command I have is at the default "CALCULATE". that goes before all of my calculated members.
Thanks!
|||The code above already includes a statement to create [SalesGrowth], at the beginning - you could append this snippet to your existing script, after the other calculated members.|||Deepak,
Thanks for exposing me to SCOPE! I was able to acheive what I wanted with just a few tweaks.
No comments:
Post a Comment