390 likes | 568 Views
UNIT 3 Calculation Script Architecture. Topics. When to use calc scripts Calc Script Editor and online help Database, dimension and member calculations Focus calculations Generate member lists Boolean functions Mathematical functions. Introducing Calc Scripts. Components of calc scripts
E N D
Topics • When to use calc scripts • Calc Script Editor and online help • Database, dimension and member calculations • Focus calculations • Generate member lists • Boolean functions • Mathematical functions
Introducing Calc Scripts • Components of calc scripts • Calc Script Editor and online Help • Commands and functions
Using Essbase Documentation (Demo) • Essbase manuals • Product online Help • HTML formatted documentation • Technical Reference
Exploring Essbase Calc Script Functionality • Functional command and functions • Control flow commands (focus) • Macro functions • Conditional commands • Boolean functions • Operators • Math functions
Using Functional Commands • CALC ALL • CALC DIM • MEMBER CALC • Other CALC script commands
(CALC ALL) Low Level data loaded Calculating the Database Using CALC ALL • Entire database is calculated. • Data is calculated based on outline consolidations and member formulas. • Syntax:CALC ALL [EXCEPT DIM(dimList)| MBR(mbrList)];
(CALC DIM) Low Level data loaded Calculating Dimensions Using CALC DIM • Calculates a specified dimension or a list of dimensions • Calculates first dimensions tagged as Accounts and as Time • Calculates dense dimensions before sparse • Syntax:CALC DIM(Accounts);
Calculating Members Using Member Calc • Unary operators and equations • All database combinations for referenced member • Syntax: MemberName ;
Focusing Calculations • FIX…ENDFIX • IF…ELSE…ELSEIF…ENDIF • CROSS DIM OPERATOR ->
FIX (East) Budget Actual East South North West Jun Feb Mar Jan Focusing Calculations Using Fix…Endfix • Isolates a portion of the database • Syntax: FIX(mbrlist) commands; ENDFIX
Focusing Calculations Using Conditional Statements • IF…ENDIF • IF…ELSE…ENDIF • IF…ELSEIF…ENDIF • IF…ELSEIF…ELSE…ENDIF
IF condition is TRUE then do statement. IF condition is FALSE, then skip statement. Focusing Calculations Using IF...ENDIF Performs conditional tests before performing a calculation • Commission (IF(Sales > 200000) • Commission = Sales * .012 ; • ENDIF)
Focusing Calculations Using ELSEIF…ELSE Performs conditional test if IF statement is FALSE • Commission • (IF(Sales >= 200000) Commission = Sales * .12; ELSEIF (Sales >= 100000) Commission = Sales * .098; • ELSE Commission = Sales * .05; ENDIF)
Sales->Jan->Actual Budget Actual Sales COGS Margin Margin% Jun Feb Jan Mar Focusing Calculations Using Cross Dim A pointer to data values of specific member combinations Syntax:->
Family @CHILDREN @DESCENDANTS @SIBLING @RELATIVE Generation and level @GENMBRS @LEVMBRS Others @UDA @MATCH Generating Lists Using Macro Functions
Given this outline FIX(@ICHILDREN(West)) … ENDFIX Applies calculations to the following: West, California, Oregon Generating Lists Using @ICHILDREN Includes the specified member and all members in the level immediately below the specified member
Given the outline FIX(@IDESCENDANTS(WEST)) … ENDFIX returns the following: West,California,San Diego,San Francisco, Los Angeles, Chico, Oregon Generating Lists Using @IDESCENDANTS Includes the specified member and either all descendants or only the descendants down to a specified generation or level.
Given the outline, FIX(@UDA(MARKET,”Small Market”)) … ENDFIX applies calculations to the following: Connecticut, New Hampshire, and South Generating Lists Using @UDA Generates a list of members that have the referenced UDA
Generating Lists Using @MATCH • Allows you to perform a wild-card search for members Given the following members FIX(@MATCH(PRODUCT,”???-10”)) … ENDFIX Returns the following: 100-10,200-10 100-10 100-20 200-10 200-30 300-20
Testing for Values Using Boolean Functions • @ISDESC • @ISMBR • @ISLEV • Logical connectors
Testing for Values Using @ISDESCENDANTS Tests member during calculation to determine appropriate formula for payroll • Payroll • (If (@ISDESC(East) OR @ISDESC (West)) • Payroll = Sales * .15; • ELSEIF (@ISDESC (Central)) • Payroll = Sales * .11; • ELSE • Payroll = Sales * .10; • ENDIF)
Testing for Values Using @ISMBR Tests to see if a member is present for a specific calculation Fix (East) Commission ( If (@ISMBR(New York: New Hampshire)) Commission = Commission * 1.25 ; Endif ) Endfix
Testing for Values Using @ISLEV Tests to see if a member is present for a specific calculation If the calculation is positioned on New York: @ISLEV(“Market”,0) is TRUE and @ISLEV(“Market”,1) is FALSE
Using Logical Connectors with Boolean Functions • AND • OR • NOT
@VAR @TRUNCATE @MIN @MOD @VARPER @ROUND @MAX @ABS Transforming Values with Math Functions
@VAR Calculates the variance (difference) between the values of two members @VAR(Actual,Budget) @VARPER Calculates the variance (difference) percent between the values of two members VARPER(Actual,Budget) Transforming Values with @VAR and @VARPER
@TRUNCATE Removes the fractional part of an expression and returns the integer. Total_Sales = @TRUNCATE( @SUM(Direct_Sales: Other_Sales)); @ROUND Rounds an expression to the nearest whole number or to a specifically decimal Profit = @ROUND("Profit_%”); Transforming Values with @TRUNCATE and @ROUND
@MIN Returns the minimum value among the results of an expression Qtr1 = @MIN(Jan:Mar) ; @MAX Returns the maximum value among the results of an expression Qtr1 = @MAX(Jan:Mar) ; Transforming Values with @MIN and @MAX
Transforming Values with @MOD • Calculates the modulus (the remainder) of a division operation Factor = @MOD("Margin %", "Profit %"); • “Margin %” = Dividend “Profit %” = Divisor
Transforming Values with @ABS • @ABS returns the absolute value of an expression. Variance = @ABS(Actual-Budget) ; • The absolute value turns negative numbers into positive numbers: @ABS(-5) = 5 @ABS(+5) = 5