Go to primary content

Moving Total

Calculates a total 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 total (sum) 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 Total

The units_mov_total calculated measure computes the total 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 total(sum) for the UNITS measure for the TIME_ATTR_DIM dimension and TIME_HIER hierarchy. Include 1 preceding and 1 following members within level.

Definition of Calculated Measure in Analytic View

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

units_mov_total AS 
  SUM (UNITS)
      OVER (HIERARCHY TIME_ATTR_DIM.TIME_HIER 
        BETWEEN 1 PRECEDING AND 1 FOLLOWING 
        WITHIN LEVEL)

SELECT Statement Using the Calculated Measure

SELECT time_hier.member_name as TIME,
 units,
 units_mov_total
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_TOTAL
--------  ------- ---------------
Q1CY2011  5892326        12061803
Q2CY2011  6169477        18201731
Q3CY2011  6139928        18570118
Q4CY2011  6260713        18227193
Q1CY2012  5826552        18255316
Q2CY2012  6168051        18136149
Q3CY2012  6141546        18574067
Q4CY2012  6264470        18232453
Q1CY2013  5826437        18263378
Q2CY2013  6172471        18144041
Q3CY2013  6145133        18580822
Q4CY2013  6263218        18236791
Q1CY2014  5828440        18262940
Q2CY2014  6171282        18138811
Q3CY2014  6139089        18574226
Q4CY2014  6263855        18298542
Q1CY2015  5895598        18331818
Q2CY2015  6172365        18210603
Q3CY2015  6142640        18579608
Q4CY2015  6264603        12407243