Technical data

Chapter 11 Using Built-in Functions in Analytic M odels
Example
Suppose that an
analytic model contains a data cube called SCORES that uses dimensions called STUDENTS
and TESTS.
Use the following formula to calculate the variance of the tests for each student:
VAR(TESTS, SCORES)
Use the following formula to calculate the variance of scores over 75 percent for each test:
VAR(STUDENTS, SCORES, 0, SCORES > 0.75)
WHILE
Syntax
WHILE(Condition, Expression)
Description
The WHILE function supports looping and takes two arguments: a condition that determines whether to
continue looping and an expression to evaluate for each iteration.
Example
WHILE(&Balance < TARGET_BALANCE .AND. &Month < NUMMEMBERS(MONTHS),
INC(&Month);
INC(&Balance
, AT(MONTHS, &Month, CA)));
IF(&Month <= NUMMEMBERS(MONTHS), &Month, #N/A)
This formula c
alculates the number of months required to accumulate a target balance.
The IF function returns the value of &Month, or an error code if the target balance is not achieved. Notice
that it is not necessary to initialize &Balance and &Month because they are initialized to zero before the
formula is evaluated.
YEAR
Syntax
YEAR({Date})
Description
The YEAR function returns the year of Date.IfDate is omitted, the function returns the year of the calculation
date.
Example
Suppose that
an analytic model contains a data cube called YEAR_EXAMPLE that uses a dimension called
MONTHS, and h
as the following formula: YEAR( ). Because the argument is omitted, YEAR returns
the year for e
ach date in the MONTHS dimension.
Copyright © 1988-2007, Oracl e. All rights reserved. 197