Академический Документы
Профессиональный Документы
Культура Документы
Agenda
Review the Basics Calc Script Commands Using Functions Controlling Execution Creating Blocks Organizing Calc Scripts Real World Calculations Optimization
Types Of Calculations
Outline consolidations Member formulas
Unary operators + - * / % Relies on hierarchy Allows complex calculations Can use functions and conditional processing Override outline operations Offer most control
Calculation scripts
Calculation Order
Outline order
Dense Sparse
Dimension order
First, Accounts Second, Time Third, all remaining dense dimensions Forth, all remaining sparse dimensions Last, Two-pass calculations
Calc Scripts
Override outline operators Specific calculation commands available Iterative calculations Variables Optimization
Has a number of functions built in Command buttons simplify entries Validation function to detect errors Limited work area
Provides a list of available functions Grouped by function type Can include parameters
Member Selection
Associate the outline Can select members from the member list Frequently easier/faster to just type the
member names
Online Help
Functions and commands are included Can also use Essbase XTD Analytic Services
documentation
Technical Reference
Calculation Commands
Not functions they are in another chapter Not Set statements they are covered under
optimization
Agg
Syntax
Summary
Array
Syntax
Summary
Calc All
Syntax
Summary
Calc All; Calculates all dimensions in the database Uses default calculation order This is typically the default calc Very efficient Can add Except to remove
dimensions/members
Calc First
Syntax
Summary
Calc First; Calculates members tagged as TB First Does not update Time dimension, only Accounts
Calc Last
Syntax
Summary
Calc Last; Calculates members tagged as TB Last Does not update Time dimension, only Accounts
Calc Average
Syntax
Summary
Calc Average; Calculates members tagged as TB Average Does not update Time dimension, only Accounts
Calc Dim
Syntax
Summary
Calc Dim(DimName, DimName,) Calculates the dimensions that are listed All dense dimensions are calculated first in the order
they appear Sparse dimensions are calculated last - also in the order they appear If you need a different order, use multiple Calc Dim commands Includes member formulas
Calc TwoPass
Syntax
Summary
CCONV
Syntax
Summary
ClearBlock
Syntax
Summary
ClearData
Syntax
Summary
ClearData MemberName; Designed to set a member value to #Missing Works within a fix
No Member name, just block type ClearData is designed to clear a member In many cases either one will work
DataCopy
Syntax
Summary
DataCopy MemberName To MemberName; Copies data from one member to another All intersections are included Great for copying versions Will create blocks if they do not exist
If/Else/ElseIf/EndIf
Syntax
Summary
IF (condition) ElseIf/Else EndIf; Condition must be if parenthesis In a calc script, associate with a member name Each If must end with EndIf Most effective on dense members
Does not really matter which member name
Fix/EndFix
Synatx
Summary
Fix(MemberNames, Functions Etc.) ENDFIX Used to focus or limit a calculation Most effective on sparse members Used extensively
Loop/EndLoop
Syntax
Summary
Using Commands
Need to combine commands with functions Execute in the order they are written None by itself is that useful Used together, they provide a powerful tool set to apply business rules to the database
Calculates the member formula if present Calculates outline rollup if there is no formula Multiple members can be listed Member set functions can also be used
Example
@IDESCENDANTS(2003)
Assignment Statements
Assign a value to a member Example There are other math operators Every command ends with a semicolon (;)
possible To force multiple passes of the database, group the member names in parenthesis
One pass for each group in parenthesis Not usually what you want, so use with caution
Function Categories
Conditional Boolean Relationship Calculation Operators Mathematical Member Set Range and Financial
Calculation Operators
Conditional
Typically used within an If command >, >=, <, <=, <>, != Can combine with And, Or and Not
Boolean
Relationship Functions
database @ANCESTVAL @LEV @ATTRIBUTEBVAL @MDANCESTVAL @ATTRIBUTESVAL @MDPARENTVAL @PARENTVAL @ATTRIBUTEVAL @SANCESTVAL @CURGEN @SPARENTVAL @CURLEV @XREF @GEN
Mathematical Functions
Allocations Functions
Allocate MDAllocate
Forecasting Functions
Statistical Functions
@STDEV
ToDate
Miscellaneous
@CALCMODE @CONCATENATE
@SUBSTRING @NAME
Using Functions
Focusing Calculations
Fix If
FIX
FIX limits the members that are processed Most effective when used on members of
sparse dimensions Only blocks that meet the Fix criteria are processed
Typical uses
Remaining blocks are simply skipped Only calculate one scenario Limit calc to current year
More on FIX
FIX works properly on dense members May result in all blocks being processed All statements between the FIX and ENDFIX
are executed as a block FIX statements an be nested Multiple members from the same dimension are treated as or
FIX On
Members from one or more dimensions Can list specific member names Can include member set functions Can include AND and OR
functions Caution on empty sets
IF Statements
Members Values
Specific members MemberSet comparisons Use boolean functions >, < = etc. Use #Missing for test
Syntax for IF
More on IF
Can have ElseIf (condition) Can Have Else Can have both Still terminate with single EndIf
Be sure to include ;
To If or FIX
dimension members Old saying Fix on Sparse, If on dense If youre dense, fix on sparse? There are always exceptions
Relationship functions
database
Allows reference to specific cells Frequently in another block Technique for complex allocations Can be used to get a value from another part of the
Example is @ParentVal()
MemberSet functions
Loops
If a block does not exist, not processed by a calc script Frequent cause of calculation problems
IF (Budget > 100)
Actual = 50;
Example
Load data Calculate the database Use the DataCopy command Place a sparse member on the left side of an
assignment statement
Load Data
Can use this to create blocks Create data records based on source information Load the file One trick is to use the Replace function of the
load rule
blocks Both Calc All/Dim and AGG will cause blocks to be created Only blocks containing data are created
DataCopy Command
Assignment Statements
If
should stop and then start the database (or application) for the settings to take effect
Housekeeping
The calculation environment is established Variables are declared Comments describing the purpose of the calc
script are entered
Controls if #Missing values are aggregated If all children and #Missing, parent is et to Caution needed if values loaded at upper levels
Initial Calculation
There may be many calculation blocks with Typically the most complex portion of the
Mainline Calculation
This is the rollup of the database May be focused Regardless, this is the major rollup of the
database
e.g. FIX(Actual)
Back Calc
other members requiring special treatment are handled Often requires recalculation of all or most of the blocks Corrects percentages and ratios that may have been summed
Clear the database Use Lock & Send to load test data Run the calc from Excel Retrieve onto a test sheet
More on Testing
resulting in long cycles and inability to get many tests in per day
Typical Issues
Intelligent Calc
FIX on too few or too many members Dynamic Calc runs after Batch Calc Referring to the wrong block
the calculation is focused
Prevents blocks from being calculated Nested FIXs are ORs, not ANDs
Dynamic calc members do not make good counters Remember, every intersection is processed unless
calculations created for customers but modified for the Sample application
Exercise
Simple Allocation Complex Allocation Comparable Sales Compute LQ (last quarter) in the scenario dimension Compute 12 month rolling average Compute Market Share and Product Mix Get data from another database
Exercise
(Continued)
Putting it together
This is for the Budget dimension only Clear upper level blocks Add the member Insurance to the Measures
dimension and load a value at the top level Allocate the insurance expense to all products based on Budgeted Sales Calculate Market Share in the calc script (may need to change storage settings); insure it is correct at all levels Include values for Last Quarter and a 6 month rolling average Perform a rollup of the database
Goal
Parallel Calculation
Apply multiple processors to a calc Only straight forward calcs can use this
Maximum of 4 processors Recommend 1 less than number on server Available in Essbase XTD Analytic
Services 6.5
Cache Settings
Dense/Sparse Settings
This will make the largest difference Other factors influence decisions If only a portion of the database is calculated
ideally you want to Fix on it as sparse members
Attribute dimensions
Reduces the number of blocks processed Smaller blocks almost always calc faster
Largest dense dimension to smallest Smallest sparse dimension to largest Hourglass shape Dimension calc order is influenced by order of dimensions in the outline Goal is to process fewest blocks possible
Faster to create blocks than to update them As data is added to blocks, they grow and cannot Old DeFrag Command no longer available
Can use SET MSG DETAIL Each block is listed as it is calculated Can determine number of times each block is
processed Can also see if expected blocks are being processed
New cache Tracks the block used in the calc Good for flat dimensions
CALCHASHTBL ON;
Other Methods
Partition
Intelligent Calc
Allows more blocks to be locked Not really optimization but Determines how many dimensions are used to
generate opportunities for the parallel calculation
Method to predict the actual calc time Based on the number of blocks that would be
created SET MSG ONLY; SET NOTICE HIGH; CALC ALL; Does not actually calc the database but provides timings Run the calc, and use ratio of actual time to simulated
Dynamic Calc
Can improve calc times significantly Make entire dimension dynamic calc Especially effective for Time dimension All upper level members of dense dimension Upper 1-2 levels of sparse dimension(s)
calc highest level
Custom Functions
Can write functions in Java Compile, save on server, and register Call from calc scripts Run slower than same calc command May run faster than complex series of database passes required to perform the same thing
Custom Macros
Not necessarily faster but might avoid errors Need to define parameters May be possible to save a pass of blocks
Database Statistics
Not a optimization technique but a tool Can monitor calculation impacts Can refresh while calc is running Copy and paste into Excel
Comments / Questions ?
Edward Roske
Office: Email:
972-735-8716 eroske@interrel.com