Conditional commands control the flow of events in formulas. You can control which formulas are executed within a calculation, test conditions, and calculate a formula based on the result of the test.
When you use an IF statement as part of a member formula in a calc script, you need to:
Associate it with a single member
Enclose it in parentheses
For example:
Profit (IF (Sales > 100) Profit = (Sales - COGS) * 2; ELSE Profit = (Sales - COGS) * 1.5; ENDIF;);
Essbase cycles through the database, performing the following calculations:
The IF statement checks to see if the value of Sales for the current member combination is greater than 100.
If Sales is greater than 100, Essbase subtracts the value in COGS from the value in Sales, multiplies it by 2, and places the result in Profit.
If Sales is less than, or equal to 100, Essbase subtracts the value in COGS from the value in Sales, multiplies it by 1.5, and places the result in Profit.
The entire IF fixend.htm ENDIF statement is enclosed in parentheses and associated with the Profit member, Profit (IF(fixend.htm)fixend.htm).