Oracle® OLAP DML Reference 11g Release 2 (11.2) Part Number E17122-07 |
|
|
PDF · Mobi · ePub |
The LAGDIF function returns the difference between the value of a dimensioned variable or expression at a specified offset of a dimension before the current value of that dimension and the current value of the dimensioned variable or expression.
See also:
"Using LAGDIF and LAGABSPCT"DECIMAL or NA
when you try to lag before the first period of a time dimension.
LAGDIF(variable, n, dimension, [STATUS|NOSTATUS|limit-clause] )
A variable or expression that is dimensioned by dimension.
The offset (that is, the number of dimension values) to lag. LAGDIF uses this value to determine the number of values that LAGDIF should go back in dimension to retrieve the value of variable. Typically, n is a positive INTEGER
that indicates the number of time periods (or dimension values) before the current one. When you specify a negative value for n, it indicates the number of time periods after the current one. In this case, LAGDIF compares the current value of the time series with a subsequent value.
The dimension along which the lag occurs. 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 variable has a dimension with a type of DAY, WEEK, MONTH, QUARTER, or YEAR and you want LAGDIF to use that dimension, you can omit the dimension argument.
Specifies that LAGDIF should use the current status list (that is, only the dimension values currently in status in their current status order) when computing the lag.
(Default) Specifies that LAGDIF should use the default status (that is, a list all the dimension values in their original order) when computing the lag.
Specifies that LAGDIF should use the default status limited by limit-clause when computing the lag.
The syntax of limit-clause is the same syntax as any of the limit-clause arguments in the various forms of the LIMIT command (that is, the syntax of the LIMIT command after the limit-type argument such as "TO"). For the syntax of these arguments, see LIMIT (using values) command, LIMIT using LEVELREL command, LIMIT (using parent relation), LIMIT (using related dimension) command, LIMIT NOCONVERT command, and LIMIT command (using POSLIST).
To specify that LAG should use the current status limited by limit-clause when computing the lag, specify a LIMIT function for limit-clause.
For an example of using LAGDIF, see Example 8-2, "Using LAGDIF and LAGABSPCT".