Go to primary content

Prior Period

Returns the value of a previous 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

Prior period for the measure name measure for the attribute dimension alias attribute dimension and hierarchy alias hierarchy number period ago.

Example: Example of Prior Period

The sales_prior_period calculated measure has the measure value for the hierarchy member that is one member before the current member at the same level.

Calculation in Template

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_prior_period calculated measure:

sales_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_prior_period values.

SELECT time_hier.member_name as TIME,
 sales,
 sales_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_PRIOR_PERIOD
--------  ---------- ------------------
CY2011    6755115981             (null)
Q1CY2011  1625299627             (null)
Q2CY2011  1715160208         1625299627
Q3CY2011  1691017693         1715160208
Q4CY2011  1723638452         1691017693
CY2012    6901682399         6755115981
Q1CY2012  1644857783         1723638452
Q2CY2012  1752414182         1644857783
Q3CY2012  1732373412         1752414182
Q4CY2012  1772037022         1732373412
CY2013    7240938718         6901682399
Q1CY2013  1723571458         1772037022
Q2CY2013  1840985832         1723571458
Q3CY2013  1821918664         1840985832
Q4CY2013  1854462764         1821918664
CY2014    7579746353         7240938718
Q1CY2014  1809855822         1854462764
Q2CY2014  1929427229         1809855822
Q3CY2014  1900013511         1929427229
Q4CY2014  1940449791         1900013511
CY2015    7941102885         7579746353
Q1CY2015  1908099573         1940449791
Q2CY2015  2018132033         1908099573
Q3CY2015  1989225699         2018132033
Q4CY2015  2025645581         1989225699