Database Reference
In-Depth Information
Previous period growths
A previous period growth calculation is defined as the growth, either in percentage
or absolute value, from the previous time period to the current one. It is very useful
when used with a time hierarchy to display the growth of the current month, quarter
or year over the previous month, quarter or year.
The key to solving this particular calculation is the PrevMember function, which
returns the member immediately before any given member on a hierarchy. For
example, if we used PrevMember with the Calendar Year 2003, it would return the
Calendar Year 2002. As a first step, let's create a calculated member that returns
Sales for the previous period to the current period, again using the Currentmember
function to get a relative reference to the current time period:
CREATE MEMBER CURRENTCUBE.Measures.PreviousPeriodSales AS
(Measures.[Sales Amount],
[Date Order].[Calendar].CurrentMember.PrevMember),
FORMAT_STRING = "#,#.00";
Here, we take the CurrentMember on the Calendar hierarchy, and then use
PrevMember to get the member before it. In order to get the sales figures for that time
period, we've created a tuple, which is simply a comma-delimited list of members
from different hierarchies in the cube enclosed in round brackets. You can think of
a tuple as a coordinate to a particular cell within the cube; when we use a tuple in a
calculation, it will always return the value from the cell it references.
 
Search WWH ::




Custom Search