Returns the percent difference between the measure value of the current member and the measure value of a previous member at the same level.
The template presents a level, a number that specifies the offset from the current member, a measure of the analytic view, an attribute dimension the analytic view is dimensioned by, a hierarchy that uses the attribute dimension, an aggregation operator, and a position. To select a different value, 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
Percent difference between the current { Level | Parent | Ancestor at level level name } to date number period ago for the measure name measure for the attribute dimension alias attribute dimension and the hierarchy alias hierarchy. Aggregate using { SUM | MAXIMUM | MINIMUM | AVERAGE } from the { beginning | end } of the period.
Example: Example of Percent Difference from Period To Date Period Ago
The SALES_PCT_DIFF_TO_DATE_YR_AGO calculated measure computes the percent difference between the running totals for the current period and for the previous period within a year. The running totals start with the last period in the year.
Calculation in Template
Percent difference between the Ancestor at level YEAR to date 1 period ago for the SALES measure in the TIME_ATTR_DIM attribute dimension and TIME.HIER hierarchy. Aggregate using SUM from the beginning of the period.
Definition of Calculated Measure in Analytic View
The MEASURES clause of the SALES_AV analytic view definition includes this definition of the SALES_PCT_DIFF_TO_DATE_YR_AGO calculated measure:
SALES_PCT_DIFF_TO_DATE_YR_AGO AS
LAG_DIFF_PERCENT (
SUM(SALES)
OVER (HIERARCHY TIME_ATTR_DIM.TIME_HIER
BETWEEN UNBOUNDED PRECEDING AND CURRENT MEMBER
WITHIN ANCESTOR AT LEVEL YEAR))
OVER (HIERARCHY TIME_ATTR_DIM.TIME_HIER OFFSET 1)
SELECT Statement Using the Calculated Measure
Query the analytic view, selecting SALES and SALES_PCT_DIFF_TO_DATE_YR_AGO values for the YEAR and QUARTER levels of the TIME_HIER hierarchy.
SELECT time_hier.member_name as TIME,
sales,
sales_pct_diff_to_date_yr_ago
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_PCT_DIFF_TO_DATE_YR_AGO -------- ---------- ----------------------------- CY2011 6755115981 (null) Q1CY2011 1625299627 (null) Q2CY2011 1715160208 1.05528862 Q3CY2011 1691017693 .506223028 Q4CY2011 1723638452 .342571033 CY2012 6901682399 .0216970987 Q1CY2012 1644857783 -0.756501918 Q2CY2012 1752414182 1.06538948 Q3CY2012 1732373412 .509930741 Q4CY2012 1772037022 .3454502 CY2013 7240938718 .049155597 Q1CY2013 1723571458 -0.750267926 Q2CY2013 1840985832 1.06812272 Q3CY2013 1821918664 .511120601 Q4CY2013 1854462764 .344281267 CY2014 7579746353 .046790568 Q1CY2014 1809855822 -0.750052322 Q2CY2014 1929427229 1.06606681 Q3CY2014 1900013511 .508122409 Q4CY2014 1940449791 .344094298 CY2015 7941102885 .047673961 Q1CY2015 1908099573 -0.7482634 Q2CY2015 2018132033 1.05766599 Q3CY2015 1989225699 .506650116 Q4CY2015 2025645581 .342432626