Home > Working with Planning Projects > Building an Application > Building Application Models > Building A Cube Model > Measure Settings > Measure Logic Functions > IF Function
IF Function
Last Updated 2/22/2012 6:43 PM
The IF function enables testing of a condition and if the condition exists then one expression is performed (condition TRUE), otherwise an alternative is performed.
Format:
IF (TEST_CONDITION, IF_TRUE EXPRESSION, IF_FALSE_EXPRESSION)
where:
TEST_CONDITION is the test condition to be evaluated to determine whether the TRUE or FALSE expression is executed.
The following logical operators can be used in the TEST_CONDITION:
EQ
LE
GE
LT
GT
NE
OR
AND
IF_TRUE_EXPRESSION is the expression that will be executed if the condition is true.
IF_FALSE_EXPRESSION is the expression that will be executed if the condition is false.
EXAMPLE:
Assume we wish to calculate a variable tax, whereby tax is 50% if the value is greater than 5000, and 30% if sales are less than or equal to 5000.
'tax'= if('sales' GT 5000, 0.5*'sales', 0.3*'sales')
See also
PREVIOUS function SUM function MAX function MIN function DEPRECIATION function INT function ROUND function ROUNDUP function ROUNDDOWN function SWITCH Function
|