Essbase 11.1.2 - Optimisation of Essbase Calculation Scripts Using NOT in IF statements

In Essbase calculation scripts, when an IF statement is performed, it will perform the first element of the IF statement first, check if the combination being calculated meets that criteria and calculate it if it does or pass to the next element, i.e the next ELSEIF. This will continue through all the ELSEIF statements and then the ELSE (if present) if the combination does not meet any of the criteria of the IF or ELSEIF.

It is possible to optimise an IF statement by first analysing which condition will be met by the majority of your data and then to try and place this IF statement as near to the top of your IF statement as possible ... if possible, of course.

In Sample.Basic (where Accounts and Time are dense), in order to illustrate this, I added a child of “Ratios” of “SalesYTD”. I then wrote the following Essbase Calculation script as an example:

SET UPDATECALC OFF;

"SalesYTD"(

IF(@ismbr("Jan"))

"SalesYTD" = "Sales";

Else

"SalesYTD"="Sales" + @prior("SalesYTD");

Endif)

In this case, 11/12th of the data meets the criteria of the ELSE condition. Only 1/12th of the data meets the criteria of the IF. Because of the @prior function in the else condition, January would have to be calculated before all other months. I will come back to this later.

I cleared and loaded the calcdat.txt data file and ran this calculation:

Total Calc Elapsed Time for [IF.csc] : [0.203] seconds

Notice that the “SalesYTD” member is calculated in Cell mode. This means that January, because it appears before other months in the outline, will be calculated first, regardless of the IF order:

Formula for member [SalesYTD] will be executed in [CELL] mode

I then changed the calculation script, switching the order of the statements and adding a NOT operator to the first condition:

SET UPDATECALC OFF;

"SalesYTD"(

IF(NOT(@ismbr("Jan")))

"SalesYTD" = "Sales" + @prior("SalesYTD");

Else

"SalesYTD"="Sales";

Endif)

I cleared, reloaded the calcdat.txt datafile, and re-ran the calculation.

The calculation, in this case, takes less than a quarter of the time in the first script because 11/12th of the data meet the criteria of the first statement in the IF block:

Total Calc Elapsed Time for [NOTIF.csc] : [0.047] seconds

In this example, it is imperative that the formula is calculated in outline order to get the correct results i.e. February must be calculated after January, March after February etc. You can use the @calcmode(Cell); command to force this to happen if it does not happen automatically.

Comments:

nice

Posted by guest on May 24, 2012 at 08:47 PM SGT #

Posted by guest on May 24, 2012 at 08:47 PM SGT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

A blog focused on Tips & Tricks about Oracle Business Intelligence (OBI), Oracle Exalytics and Oracle Enterprise Performance Management (EPM) products.
[Blog Admin: ahmed awan]

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today