ENDIF

The ENDIF calculation command for Essbase marks the end of an IF command sequence. The ENDIF command can be used only in conjunction with IF or IF ... ELSEIF statements.

Syntax

ENDIF;

Notes

  • You must supply an ENDIF statement for every IF statement in your formula or calculation script. If you do not supply the required ENDIF statements, your formula or calculation script does not verify.

  • If you are using an IF statement nested within another IF statement, end each IF with an ENDIF. For example:

    "Opening Inventory"
      (IF (@ISMBR(Budget))
            IF (@ISMBR(Jan))
            "Opening Inventory" = Jan;
            ELSE
            "Opening Inventory" = @PRIOR("Ending Inventory");
            ENDIF;
      ENDIF;)
  • You do not need to end ELSE or ELSEIF statements with ENDIF statements.

  • Although ending ENDIF statements with a semicolon is not required, it is good practice to follow each ENDIF statement in your formula or calculation script with a semicolon.

  • IF, ELSE, ELSEIF, and ENDIF must all be used within a database outline formula, or must be associated with a member in the database outline when used in a calculation script.

Example

The following example is based on the Sample Basic database. This calculation script tests to see if the current member in the Market dimension is a descendant of West or East. If so, Essbase multiplies the value for Marketing by 1.5. The calculation script then tests to see if the current member is a descendant of South. If so, Essbase multiplies the value for Marketing by .9. If the current member is not a descendant of West, East, or South, Essbase multiplies the value for Marketing by 1.1.

IF (@ISMBR(@DESCENDANTS(West))
         OR 
    @ISMBR(@DESCENDANTS(East))
       )
    Marketing = Marketing * 1.5;
ELSEIF(@ISMBR(@DESCENDANTS(South))
    )
    Marketing = Marketing * .9;
ELSE 
    Marketing = Marketing * 1.1;
ENDIF;