Go to primary content

Difference from Prior Period

Returns the difference between the current value and the value of an earlier period at the same level.

The template presents a measure of the analytic view, an attribute dimension the analytic view is dimensioned by, a hierarchy that uses the attribute dimension, and a number that specifies the offset from the current member. To select a different measure, attribute dimension, hierarchy, or number, click the underlined value in the template and make a selection from the Select Measures dialog box or the drop-down list or enter a different number value.

Template

Difference from prior period for the measure name measure for the attribute dimension alias attribute dimension and the hierarchy alias hierarchy for the number period ago.

Example: Example of Difference from Prior Period

The sales_chg_prior_period calculated measure calculates the difference between the measure value for the current member and the measure value for the hierarchy member that is one member before the current member at the same level.

Calculation in Template

Difference from prior period for SALES in TIME_ATTR_DIM and TIME_HIER hierarchy 1 period ago.

Definition of Calculated Measure in Analytic View

The MEASURES clause of the SALES_AV analytic view definition includes this definition of the sales_chg_prior_period calculated measure:

  sales_chg_prior_period AS LAG (SALES) OVER (HIERARCHY TIME_HIER OFFSET 1)

SELECT Statement Using the Calculated Measure

Query the analytic view, selecting sales and sales_chg_prior_period values.

SELECT time_hier.member_name as TIME,
 sales,
 sales_chg_prior_period
FROM
 sales_av HIERARCHIES(time_hier)
WHERE time_hier.level_name IN ('YEAR','QUARTER')
ORDER BY time_hier.hier_order;

Results of the Query

TIME     SALES       SALES_CHG_PRIOR_PERIOD
-------- ----------  ----------------------
CY2011    6755115981                 (null)
Q1CY2011  1625299627                 (null)
Q2CY2011  1715160208             89860580.7
Q3CY2011  1691017693            -24142515.1
Q4CY2011  1723638452             32620759.5
CY2012    6901682399              146566418
Q1CY2012  1644857783            -78780669.2
Q2CY2012  1752414182              107556399
Q3CY2012  1732373412            -20040770.2
Q4CY2012  1772037022             39663610.4
CY2013    7240938718              339256319
Q1CY2013  1723571458            -48465564.6
Q2CY2013  1840985832              117414375
Q3CY2013  1821918664            -19067168.9
Q4CY2013  1854462764             32544100.5
CY2014    7579746353              338807635
Q1CY2014  1809855822            -44606941.6
Q2CY2014  1929427229              119571406
Q3CY2014  1900013511            -29413717.6
Q4CY2014  1940449791             40436279.7
CY2015    7941102885              361356532
Q1CY2015  1908099573              -32350218
Q2CY2015  2018132033              110032460
Q3CY2015  1989225699            -28906334.2
Q4CY2015  2025645581             36419882.4