Go to primary content

Moving Maximum

Returns the largest value among 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 maximum for 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 Maximum

The units_mov_max calculated measure returns the maximum 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 maximum for the UNITS measure for the TIME_ATTR_DIM dimension and TIME_HIER hierarchy. Include 1 preceding and 1 following members within ancestor at level YEAR.

Definition of Calculated Measure in Analytic View

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

units_mov_max AS 
  MAX (UNITS)
      OVER (HIERARCHY TIME_ATTR_DIM.TIME_HIER 
        BETWEEN 1 PRECEDING AND 1 FOLLOWING 
        WITHIN ANCESTOR AT LEVEL YEAR)

SELECT Statement Using the Calculated Measure

SELECT time_hier.member_name as TIME,
 units,
 units_mov_max
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_MAX
--------  ----------  -------------
Q1CY2011     5892326        6169477
Q2CY2011     6169477        6169477
Q3CY2011     6139928        6260713
Q4CY2011     6260713        6260713
Q1CY2012     5826552        6168051
Q2CY2012     6168051        6168051
Q3CY2012     6141546        6264470
Q4CY2012     6264470        6264470
Q1CY2013     5826437        6172471
Q2CY2013     6172471        6172471
Q3CY2013     6145133        6263218
Q4CY2013     6263218        6263218
Q1CY2014     5828440        6171282
Q2CY2014     6171282        6171282
Q3CY2014     6139089        6263855
Q4CY2014     6263855        6263855
Q1CY2015     5895598        6172365
Q2CY2015     6172365        6172365
Q3CY2015     6142640        6264603
Q4CY2015     6264603        6264603