Skip Headers
Oracle® OLAP DML Reference
10g Release 2 (10.2)

Part Number B14346-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

MOVINGMAX

The MOVINGMAX function (abbreviated MVMAX) returns a series of maximum values of a dimensioned variable or expression over a specified dimension. For each dimension value in status, MOVINGMAX searches the data for the maximum value in the range specified, relative to the current dimension value.

When the variable or expression has only the specified dimension, MOVINGMAX produces a single series of maximum values, one for each dimension value in the status. When the variable or expression has dimensions other than the one specified, MOVINGMAX produces a separate series of maximum values for each combination of values in the status list of the other dimensions

Return Value

DECIMAL

Syntax

MOVINGMAX(expressionstartstopstep, [dimension [STATUS|limit-clause]])

Arguments

expression

A numeric variable or calculation from whose values you want to find the maximum values; for example, units or sales-expense.

start

A whole number that specifies the starting point of the range over which you want to search. The range is specified relative to the current value of dimension. Zero (0) refers to the current value, and -1 refers to the period preceding the current value. A comma is required before a negative start number.

Each maximum value is based on data for a specified range of dimension values preceding, including, or following the one for which the maximum value is being returned. To count the values in the range, MOVINGMAX uses the default status, unless you use the STATUS keyword or the limit-clause argument to specify a different dimension status.

stop

A whole number that specifies the ending point of the range over which you want to search. A negative stop number must be preceded by a comma.

step

A positive whole number that specifies whether to search every value in the range, every other value, every third value, and so on. A value of 1 for step means search every value. A value of 2 means check the first value, the third value, the fifth value, and so on. For example, when the current month is Jun96 and the start and stop values are -3 and 3, a step value of 2 means search the months Mar96, May96, Jul96, and Sep96 and return the maximum value that occurs in one of those four months.

dimension

The dimension over which the moving maximum is calculated. While this can be any dimension, it is typically a hierarchical time dimension of type TEXT that is limited to a single level (for example, the month or year level) or a dimension with a type of DAY, WEEK, MONTH, Quarter, or YEAR.

When expression has a dimension with a type of DAY, WEEK, MONTH, QUARTER, or YEAR and you want MOVINGMAX to use that dimension, you can omit the dimension argument.

STATUS

Specifies that MOVINGMAX should use the current status list (that is, only the dimension values currently in status in their current status order) when calculating the moving maximum.

limit-clause

Specifies that MOVINGMAX should use the default status limited by limit-clause when calculating the moving maximum. You can use any valid LIMIT clause (see the entry for the LIMIT command for further information). To specify that MOVINGMAX should use the current status limited by limit-clause when calculating the moving maximum, specify a LIMIT function for limit-clause.

Examples

For an example of calculating maximum sales, see Example 20-9, "Calculating a Moving Average".