You are on page 1of 4

Calculation Commands

We create calculation scripts using the Calculation Script Editor. You use calculation scripts to create calculations that differ from those defined in the database outline. When a database is created, a default calculation script is set to "calculate all", which means that it wilcalculate aldimensions based on the database outline's hierarchicarelationships and formulas. Within the Calculation Script Editor, a dialog box is available that allows you to paste functions while you develop formulas. You can override this default script by using a custom script. You can use the custom script(s) temporarily or permanently, without altering the default script. In the custom script, you can refer to calculation rules defined in the database outline or you can specify custom formulas, calculation formats, and calculation orders. A calculation script contains a series of calculation commands. The order of the commands defines the execution order of the calculation.

Calculation Operators
Calculation operators define equations for member formulas and calc scripts. The calculation Operators includes: 1. mathematical, 2. conditionaand logical, and 3. cross-dimensional

Calculation Command Groups


ConditionaCommands ControFlow Commands Data Declaration Commands FunctionaCommands Member Formulas ConditionaCommands It controls the flow of events in formulas. We can controwhich formulas are executed within a calculation. The ConditionaCommands includes: IF ENDIF ELSE ELSEIF When we use IF with any member formula need to : 1. Enclosed within parentheses 2. Associate it with single member E.g.:- For example:
Profit (IF (Sales > 100) Profit = (Sales - COGS) * 2; ELSE Profit = (Sales - COGS) * 1.5; ENDIF;);

ControFlow Commands The controFlow Commands controls the flow of a calculation script. The FIXENDFIX and EXCLUDEENDEXCLUDE commands restrict calculations to specified members. The LOOP...ENDLOOP command enables repetition. Data Declaration Commands This command is used to declare/set the initiavalue of temporary variables. The scope of this variable is up to the calculation script or exist while the calculation script is being processed. If you want to report these values, you need to create members within the database outline, or assign the values from the variables into existing members. 1. VAR 2. ARRAY Functional Commands This is particularly used to perform operations such as calculation, data copying, exporting data, clearing data, and Currency Conversion.
AGG CALC ALL CALC AVERAGE CALC DIM CALC FIRST CALC LAST CALC TWOPASS CCONV CLEARBLOCK CLEARCCTRACK CLEARDATA DATACOPY DATAEXPORT DATAEXPORTCOND DATAIMPORTBIN SET DATAEXPORTOPTIONS SET DATAIMPORTIGNORETIMESTAMP SET AGGMISSG SET CACHE SET CCTRACKCALC SET CLEARUPDATESTATUS SET FRMLBOTTOMUP SET FRMLRTDYNAMIC SET LOCKBLOCK SET MSG SET NOTICE SET REMOTECALC SET UPDATECALC SET UPTOLOCAL

Member Formulas
One of the coolest things in Essbase is that you can create a formula which will be attached to a member in the database outline this is called as member formula. If the member is tagged as Dynamic Calc, the formula will execute when the user is trying to retrieve the data for that member. If the member is tagged as Store Data, the formula will execute when a calculation script is executed against that member.

Member formulas can be constructed by using some of the available commands and functions of which a few are listed here: Conditional coding functions like IF, ELSEIF, and ENDIF Boolean (true or false) functions like ISMBR, ISCHILD, and ISDESC Relationship functions like @LEV, @GEN, and @CURGEN Mathematical operators like +, -, *, and / Math functions like @ABS, @SUM, and @MOD

a formula in a calculation script defines mathematical relationships between database members. For example, the following expressions are valid within a calculation script:
"Profit_%"; Expenses = Payroll + Marketing;

Independent Member Formula


Essbase optimizes calculation performance by calculating formulas for a range of members in the same dimension. good example is that of cash flow, in which the opening inventory is dependent on the closing inventory from the previous month. When you use an interdependent formula in a calc script, the same rules apply as for the IF statement. You need to: Associate the formula with a single member l Enclose the formula in parentheses If you place the following interdependent formula in a calc script, you construct it as follows:
"Opening Inventory" (IF(NOT @ISMBR (Jan))"Opening Inventory" = @PRIOR("Ending Inventory")); ENDIF; "Ending Inventory" = "Opening Inventory" - Sales + Additions;)

The entire formula is enclosed in parentheses and associated with the Opening Inventory member, "Opening Inventory" (IF(fixend.htm)).

AGG---(data consolidation )
It Consolidates database values. This command ignores all member formulas, consolidating only parent/child relationships. The AGG command performs a limited set of high-speed consolidations. AGG is faster than the CALC commands when calculating sparse dimensions. it cannot calculate formulas. Notes 1. AGG only works with sparse dimensions. 2. When a dimension contains fewer than 6 levels, The AGG is typically faster than CALC. Conversely, the CALC command is usually faster on dimensions with six or more levels. e.g.
AGG(Market); AGG(Product,Market,Scenario);

ARRAY
Declares one-dimensional array variables. e.g.:ARRAY ALLS[Year];

Creates a one-dimensional array called ALLS to store the value. The size of ALLS is based on the number of members in the Year dimension NOTE:

1. Arrays are used to temporarily store variables as part of a member formula. 2. The size of the array variable is determined by the corresponding dimension. e.g.:-if dimension Period has 12 members, ARRAY Discount[Period] has 12 members. To create multiple arrays simultaneously, separate the array declarations in the ARRAY command with commas, as shown in the Example.
ARRAY discount[Scenario], tmpProduct[Product];

yields an array of 4 entries, with the values 1 through 4 entered in those four entries.
ARRAY discount[Scenario] = {1, 2, 3, 4};

3. You can calculate data for an array directly as part of a member formula. As the member formula is processed, each value in the array is assigned as its member is evaluated in the calculation. 4. Do not use quotation marks (") in variables; for example:
ARRAY "discount"

-------------------------

SET AGGMISSG: Specifies whether Analytic Services consolidates #MISSING values in the database.

Notes
SET AGGMISSG commands apply to calculating sparse dimensions.
SET AGGMISSG OFF/ON; If AGGMISSING OFF is your system default #MISSING values are not aggregated to their parents.

--------------------

You might also like