Checks if the condition is true and uses the first value of the condition for every row (value_if_true). If the condition is false the second value of the condition (value_if_false) is used for every row.

Signature

IF(condition[, value_if_true[, value_if_false]])

Parameters

condition is a cube or expression that is validated to either true of or false. The value of 0 is interpreted as false and all other values are interpreted as true. Comparisons inside of conditions can be configured with logical functions.

value_if_true will be chosen when the condition is validated to true.

Available since 3.5.0: If this parameter is not present, the function result is the same as if the function was 'IF(condition, condition)'.

value_if_false will be chosen when the condition is validated to false.

value_if_true and value_if_false need to have the same dimensionality, if they are more fine-granular than the condition.

Example

Dividends Pay-Out

With earnings, we pay out 50% of our net income to shareholders. Simple If formula with greater than logical function solves the task.