Technical data
Chapter 11 Using Built-in Functions in Analytic M odels
CUBEID
Syntax
CUBEID(Cube)
Description
The CUBEID function returns the internal ID of the cube in the analytic calculation engine. Note that the
actual ID for the cube ma y vary in the analytic calculation engine when the model has been changed. For
example, when a part is added or deleted. Do not use absolute numbers to compare the return of the CUBEID
function. The CUBEID function may be useful if you have a generic user function and you want to pass
different data cubes as expression arguments.
Returns
The internal ID of the cube in the analytic calculation engine.
Example
IF(CUBEID(@MyCube) = CUBEID(REVENUE), SPECIAL_CONDITION_CALCULATION, DEFAULT_⇒
CALCULATION)
This is an example of incorrect usage of the CUBEID function:
IF( CUBEID(@MYCUBE) = 512, SPECIAL_CONDITION, DEFAULT_CONDITION)
CUMAVG
Syntax
CUMAVG(Dimension, Data, {Count})
Description
The CUMAVG function returns the cumulative average of Data for the last Count members of Dimension.If
Count is omitted, CUMAVG returns the cumulative average of all members up to the member being calculated.
Example
The followin
g examples provide uses of the CUMAVG function:
Example 1
Suppose an analytic model contains a data cube called SCORES that uses a dimension called TESTS.Usethe
following formula to compute the average of all test scores up to the test being calculated:
CUMAVG(TESTS, SCORES)
This formul
a calculates Cum_Avg_Score for Test 2 by averaging the scores for Test 1 and Test 2; it calculates
Cum_Avg_Sc
ore for Test 3 by averaging the scores for Test 1, 2, and 3; and so on. Because the third argument
is omitted,
the function averages the scores for all tests up to the test being calculated.
Example 2
Suppose an analytic model contains a data cube called SALES that uses a dimension called MONTHS.Compute
the average sales for the last six months as follows:
Copyright © 1988-2007, Oracl e. All rights reserved. 147