Calculates an average for a fixed number of consecutive periods surrounding the current period.
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, numbers that specify the number of members before and after the current member, and a level. 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
Moving average for the measure name measure for the attribute dimension alias attribute dimension and the hierarchy name hierarchy. Include number preceding and number following members within { level | parent | ancestor at level level name }.
Example: Example of Moving Average
The units_mov_avg calculated measure computes the average number of units within the range of time periods that include: the current time period, the previous period, if any, and the next time period, if any.
Calculation in Template
Moving average for the UNITS measure in the TIME_ATTR_DIM dimension and the TIME_HIER hierarchy. Include 1 preceding and 1 following members within parent.
Definition of Calculated Measure in Analytic View
The MEASURES clause of the SALES_AV analytic view definition includes this definition of the units_mov_avg calculated measure:
units_mov_avg AS
AVG (UNITS)
OVER (HIERARCHY TIME_ATTR_DIM.TIME_HIER
BETWEEN 1 PRECEDING AND 1 FOLLOWING
WITHIN PARENT)
SELECT Statement Using the Calculated Measure
SELECT time_hier.member_name as TIME,
units,
units_mov_avg
FROM
sales_av HIERARCHIES(time_hier)
WHERE time_hier.level_name IN ('QUARTER')
ORDER BY time_hier.hier_order;
Results of the Query
TIME UNITS UNITS_MOV_AVG -------- ---------- ------------- Q1CY2011 5892326 6030901.5 Q2CY2011 6169477 6067243.67 Q3CY2011 6139928 6190039.33 Q4CY2011 6260713 6200320.5 Q1CY2012 5826552 5997301.5 Q2CY2012 6168051 6045383 Q3CY2012 6141546 6191355.67 Q4CY2012 6264470 6203008 Q1CY2013 5826437 5999454 Q2CY2013 6172471 6048013.67 Q3CY2013 6145133 6193607.33 Q4CY2013 6263218 6204175.5 Q1CY2014 5828440 5999861 Q2CY2014 6171282 6046270.33 Q3CY2014 6139089 6191408.67 Q4CY2014 6263855 6201472 Q1CY2015 5895598 6033981.5 Q2CY2015 6172365 6070201 Q3CY2015 6142640 6193202.67 Q4CY2015 6264603 6203621.5