39
UNIT 3 Calculation Script Architecture

UNIT 3 Calculation Script Architecture

Embed Size (px)

DESCRIPTION

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 - PowerPoint PPT Presentation

Citation preview

Page 1: UNIT 3 Calculation Script Architecture

UNIT 3

Calculation Script Architecture

Page 2: 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

Page 3: UNIT 3 Calculation Script Architecture

Introducing Calc Scripts

• Components of calc scripts

• Calc Script Editor and online Help

• Commands and functions

Page 4: UNIT 3 Calculation Script Architecture

Using Calc Script Editor (Demo)

Page 5: UNIT 3 Calculation Script Architecture

Using Essbase Documentation (Demo)

• Essbase manuals

• Product online Help

• HTML formatted documentation

• Technical Reference

Page 6: UNIT 3 Calculation Script Architecture

Exercise 3-1: Explore Calc Script Editor

and Online Help

Page 7: UNIT 3 Calculation Script Architecture

Exploring Essbase Calc Script Functionality

• Functional command and functions

• Control flow commands (focus)

• Macro functions

• Conditional commands

• Boolean functions

• Operators

• Math functions

Page 8: UNIT 3 Calculation Script Architecture

Using Functional Commands

• CALC ALL

• CALC DIM

• MEMBER CALC

• Other CALC script commands

Page 9: UNIT 3 Calculation Script Architecture

(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)];

Page 10: UNIT 3 Calculation Script Architecture

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);

(CALC DIM)

Low Level data loaded

Page 11: UNIT 3 Calculation Script Architecture

Calculating Members Using Member Calc

• Unary operators and equations

• All database combinations for referenced member

• Syntax:MemberName ;

Page 12: UNIT 3 Calculation Script Architecture

Exercise 3-2:Use Calc Functions

Page 13: UNIT 3 Calculation Script Architecture

Focusing Calculations

• FIX…ENDFIX

• IF…ELSE…ELSEIF…ENDIF

• CROSS DIM OPERATOR ->

Page 14: UNIT 3 Calculation Script Architecture

Focusing Calculations Using Fix…Endfix

• Isolates a portion of the database

• Syntax:FIX(mbrlist)

commands;

ENDFIX

East

South

North

West

Jan

Feb

Mar Jun

Actual

Budget

FIX (East)

Page 15: UNIT 3 Calculation Script Architecture

Focusing Calculations Using Conditional Statements

• IF…ENDIF

• IF…ELSE…ENDIF

• IF…ELSEIF…ENDIF

• IF…ELSEIF…ELSE…ENDIF

Page 16: UNIT 3 Calculation Script Architecture

Focusing Calculations Using IF...ENDIF

Performs conditional tests before performing a calculation

Commission (IF(Sales > 200000)

Commission = Sales * .012 ;

ENDIF)

IF condition is TRUE then do statement.IF condition is FALSE, then skip statement.

Page 17: UNIT 3 Calculation Script Architecture

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)

Page 18: UNIT 3 Calculation Script Architecture

Focusing Calculations Using Cross Dim

A pointer to data values of specific member combinations

Syntax:->

BudgetActual

Sales

COGS

Margin

Margin%

Jan

Feb

Mar Jun

Sales->Jan->Actual

Page 19: UNIT 3 Calculation Script Architecture

Exercise 3-3:Focus Calculations

Page 20: UNIT 3 Calculation Script Architecture

Generating Lists Using Macro Functions

• Family

• @CHILDREN

• @DESCENDANTS

• @SIBLING

• @RELATIVE

• Generation and level

• @GENMBRS

• @LEVMBRS

• Others

• @UDA

• @MATCH

Page 21: UNIT 3 Calculation Script Architecture

Generating Lists Using @ICHILDREN

Includes the specified member and all members in the level immediately below the specified member

Given this outline

FIX(@ICHILDREN(West))…ENDFIXApplies calculations tothe following:West, California, Oregon

Page 22: UNIT 3 Calculation Script Architecture

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(@IDESCENDANTS(WEST))…ENDFIXreturns the following:West,California,San Diego,SanFrancisco, Los Angeles, Chico,Oregon

Page 23: UNIT 3 Calculation Script Architecture

Generating Lists Using @UDA

Generates a list of members that have the referenced UDA

Given the outline,

FIX(@UDA(MARKET,”Small Market”))…ENDFIXapplies calculations tothe following:Connecticut, New Hampshire, and South

Page 24: UNIT 3 Calculation Script Architecture

Generating Lists Using @MATCH

• Allows you to perform a wild-card search for members

100-10

100-20

200-10

200-30

300-20

Given the following membersFIX(@MATCH(PRODUCT,”???-10”))

ENDFIX

Returns the following:

100-10,200-10

Page 25: UNIT 3 Calculation Script Architecture

Exercise 3-4:Using Macro Functions

Page 26: UNIT 3 Calculation Script Architecture

Testing for Values Using Boolean Functions

• @ISDESC

• @ISMBR

• @ISLEV

• Logical connectors

Page 27: UNIT 3 Calculation Script Architecture

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)

Page 28: UNIT 3 Calculation Script Architecture

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

Page 29: UNIT 3 Calculation Script Architecture

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

Page 30: UNIT 3 Calculation Script Architecture

Using Logical Connectors with Boolean Functions

• AND

• OR

• NOT

Page 31: UNIT 3 Calculation Script Architecture

Exercise 3-5:Using Boolean Functions

Page 32: UNIT 3 Calculation Script Architecture

• @VAR

• @TRUNCATE

• @MIN

• @MOD

Transforming Values with Math Functions

• @VARPER

• @ROUND

• @MAX

• @ABS

Page 33: UNIT 3 Calculation Script Architecture

Transforming Values with @VAR and @VARPER

• @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)

Page 34: UNIT 3 Calculation Script Architecture

Transforming Values with @TRUNCATE and @ROUND

• @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_%”);

Page 35: UNIT 3 Calculation Script Architecture

Transforming Values with @MIN and @MAX

• @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) ;

Page 36: UNIT 3 Calculation Script Architecture

Transforming Values with @MOD

• Calculates the modulus (the remainder) of a division operation

Factor = @MOD("Margin %", "Profit %");

• “Margin %” = Dividend

“Profit %” = Divisor

Page 37: UNIT 3 Calculation Script Architecture

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

Page 38: UNIT 3 Calculation Script Architecture

Exercise 3-6:Math Functions

Page 39: UNIT 3 Calculation Script Architecture

Test Your Understanding