SELF

Syntax

SELF ( )

Description

The SELF function returns the current value of the data cube that is being calculated. The SELF function recalculates the data cube only if a certain condition is true; otherwise, the data cube retains its current value.

Returns

The current value of the data cube being calculated.

Example

Suppose that you would like to update your sales forecast on a monthly basis, but you also would like to save the original forecast. If the current forecast is stored in a data cube called SALES_FORECAST, you can calculate the ORIGINAL_SALES_FORECAST cube as follows:

IF(UPDATE_ORIGINAL, SALES_FORECAST, SELF( ))

(See the entry for the IF built-in function if you are unfamiliar with this function.) UPDATE_ORIGINAL is a single value data cube that contains either a true or false value. If UPDATE_ORIGINAL is false, the SELF function returns the current value of ORIGINAL_SALES_FORECAST, thereby leaving the original forecast unchanged. If UPDATE_ORIGINAL is true, the IF function returns the value of SALES_FORECAST, thereby updating the original forecast.

Related Topics