Technical data
Chapter 10 Creating Rules, Formulas, and User Functions
Some functions do not take any arguments because they do not require additional information to calculate a
result. For e xample, the PI function returns the mathematical constant pi. Because this function does not require
any information, it does not take any arguments. Nevertheless, you must still follow the function name with
parentheses. For example, the following formula calculates the circumference of a circle using the PI function:
PI( ) * DIAMTER_OF_CIRCLE
The parentheses following PI indicate that the name is a function rather than a data cube reference.
Many function
s have one or more optional arguments. If y ou leave out an optional argument, the analytic
calculation e
ngine supplies a default value for the argument. For example, the CHANGE function calculates
the change bet
ween members of a dimension and takes these arguments in order:
1. The dimension for which you want to calculate the change.
2. The information for which you want to calculate the change.
3. How many members back to look.
Note. The third argument is optional; if you do not include it, the analytic calculation engine assumes
you want to calculate the change from only the previous member.
For example, s
uppose you want to calculate the monthly c hange in sales. You can use the C HANGE function
and leave out
the third argument, as shown in the following formula:
CHANGE(MONTHS, SALES)
For each month
, the analytic calculation engine calculates the change in sales from the previous month.
Now suppose you want to calculate the yearly change in sales. Yo u can use the CHANGE function and supply
12 as the third argument, as shown in the following formula:
CHANGE(MONTH
S, SALES, 12)
For each month, the analytic calculation engine calculates the change in sales from 12 previous months. To
summarize:
• You must always place parentheses after a function name.
• If a function contains arguments, place the arguments inside the parentheses.
• If a function contains more than one argument, separate the arguments with commas.
• You can leave out an optional argument if the default value for the argument is satisfactory.
See C
hapter 11
, “Using Built-in Functions in Analytic Models,” CHANGE, page 144.
Conditions and Conditional Formulas
A condition is an expression that evaluates as true or false. A conditional formula returns different values for
different conditions. The most simple conditional formula returns one value if a specified condition is true, and
a different value if the condition is false. A complex conditional formula may return many different values
based on many different conditions. These are types of conditions and conditional formulas:
• Comparison o
perators.
• Truth functi
ons.
• Compound con
ditions.
See “Comparison Operators”, “Truth Functions”, “Compound Conditions.”
Copyright © 1988-2007, Oracl e. All rights reserved. 121