Technical data
Chapter 10 Creating Rules, Formulas, and User Functions
d. Enter a comma.
4. Perform these steps to enter a final Condition:Result pair to return a result for all o ther members in
the dimension:
a. Enter #DEFAULT
as the condition.
#DEFA U LT instructs the fu nction to ret urn the final result for all other members.
b. Enter a colon to separate the condition from the result.
c. Enter the resul
t for all other members in the dimension.
d. Enter a closing parenthesis.
Creating Diffe
rent Calculations for Different Groups of Members
Sometimes you may want to calculate a data cube in different ways for different groups of members. To
perform different calculations for different groups of members:
1. Create an association data cube that associates each member with a group.
See C
hapter 5,
“Creating Data Cubes,” Creating Association Data Cubes, page 39.
2. Define a formu
la for the result data cube.
3. Use the CASE fu
nction to evaluate two or more Condition:Result pairs.
Perform the fo
llowing steps for each Condition:Result pair:
See C
hapter 11, “Using Built-in Functions in Analytic M odels,” CASE, page 144.
a.
Use a m emb er reference to com pare the association data cube to on e of the members in the gro up
dimension.
This example is a formula for the INVEST_TYPE data cube:
[TYPES:Stock]
See Chapter 10, “Creating Rules, Formulas, and User Functions,” Inserting a Dimension
Member Reference in t o a Rule, page 129.
b.
Enter a colon t
o separate the condition and result.
c. Enter the appropriate result for that gro up.
d. To add another Cond ition:Result pair, enter a comm a ; otherwise, enter a closing p arenthesis.
Example: Crea
ting Different Calculations f or Different Groups of Members
Suppose that you create an analytic model to track your investments in stocks, bonds, and rental properties,
and you want to know your monthly income. Because the income for stocks, bonds, and rental properties is
calculated differently, you need to perform different calculations for different groups of these investments.
Create a data cube that associates each investment with an investment type. Suppose the dimension of
investment types is called TYPES, and the association data cube is called INVEST_TYPE. You can calculate
the investment income for each investment as follows:
CASE(INVEST_TYPE = [TYPES:Stock] : NUMBER_OF_SHARES * DIVIDENDS_PER_SHARE, INVEST_⇒
TYPE = [TYPES:Bond] : BOND_RATE * BOND_AMOUNT / 12, INVEST_TYPE = [TYPES:Rent] :⇒
MONTHLY_REN
T)
See Chapter 5, “Creating Data Cubes,” Creating Association Data Cubes, page 39.
Copyright © 1988-2007, Oracl e. All rights reserved. 133