Example: @RANKSKIPBOTH,Sales,@RANGESales,@LEVMBRSProduct,1; In this example, we return the rank of products based on Sales as Essbase loops through the member list returned by the @RANGE
Trang 1In this example, the @MOVSUM() function smoothes sales data for the first six months of the year on a three month term
Statistical
Statistical functions are used to compute descriptive statistics Some of the statistical functions are @COUNT(), @RANK(), and @MEDIAN(), just to name a few
• @COUNT: Returns the number of values available in the specified member list You have the option to exclude the #MISSING, ZEROS, BOTH, or NONE
Syntax:
@COUNT(SKIPNONE | SKIPMISSING | SKIPZEROS | SKIPBOTH , MEMBERLIST);
MEMBERLIST is a comma separated list of members or you can use any
of the provided member set functions
Example:
@COUNT(SKIPBOTH,@RANGE("TOTAL REVENEUE",@CHILDREN("CARS")));
This example will return the number of children of the CARS member that
have a value in the TOTAL REVENUE member
• @RANK(): This function returns the rank of a specified member The rank
of a value is equivalent to its position (its rank) in the sorted data set
Syntax:
@RANK (SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH, value,
expList);
value is the position (rank) of the member who's value you wish to return
from expList
Example:
@RANK(SKIPBOTH,Sales,@RANGE(Sales,@LEVMBRS(Product,1)));
In this example, we return the rank of products based on Sales as Essbase
loops through the member list returned by the @RANGE() function.
• @MEDIAN(): Returns the median (middle number) of the specified data
set (expList) Half of the numbers in the data set are larger than the median, and half are smaller
Syntax:
@MEDIAN (SKIPNONE | SKIPMISSING | SKIPZERO | SKIPBOTH, expList);
Trang 2@MEDIAN(SKIPBOTH,@RANGE(Sales,@CHILDREN(Product)));
This example returns the median (middle value) of the Product dimension
based on the value of Sales
Date and Time
The date and time category only has one function, and it is new for Essbase
version 9.x That function is called @TODATE().
@TODATE(): Coverts a date string into numbers of seconds elapsed
since midnight, January 1, 1970
Syntax:
@TODATE (FormatString, date)
Format of String can either be "mm-dd-yyyy" or "dd-mm-yyyy"
Example:
@TODATE("mm-dd-yyyy","12-12-2008");
Miscellaneous
Finally, we have a few miscellaneous calculation functions which do not belong in
any of the other categories There are only three miscellaneous functions which are
@CALCMODE(), @CONCATENATION(), and @SUBSTRING()
• @CALCMODE(): This function tells the calc script how the formulas need to be calculated The @CALCMODE() function can tell Essbase to toggle between two different calculation modes First, you can toggle between CELL and BLOCK
modes, then, in a second statement, you can toggle between formulas being calculated in TOPDOWN or BOTTOMUP modes
What a handy function!
Syntax:
@CALCMODE(CELL | BLOCK | TOPDOWN | BOTTOMUP);
Example:
@CALCMODE(CELL);
@CALCMODE(BOTTOMUP);
The two statements above will place Essbase in the CELL mode for
calculating and also calculate member formulas from the bottom up
Trang 3• @CONCATENATE() and @SUBSTRING(): These functions are used to manipulate
the string values in member names as the calculation script is running
° @CONCATENATE(): This is used to concatenate to two given
strings These strings can also be member names
Syntax:
@CONCATENATE(STRING1, STRING2)
Example:
@CONCATENATE("a","West");
This example returns a string value of aWest which can be used elsewhere
for testing member names
@SUBSTRING(): This is used to return string characters from
the specified string from given starting and ending positions
Syntax:
@SUBSTRING(STRING, STARTING POSITION, ENDING POSITION)
° STRING: Can be a String or a member name
° STARTING POSITION: The position from where you want to select
the first character of the substring The first position in the string
is zero (0)
° ENDING POSITION: The last position you wish to select for your
substring If omitted, @SUBSTRING() will stop at the last character
in the string being evaluated
Example:
@SUBSTRING("TOTAL MARKET",0,4);
In this example, the function returns the string value of TOTAL
Order of calculation
By now, you have a good understanding of what an Essbase calculation is You
have learned about a head-spinning number of database calculation functions and
commands We now need to describe for you another one of those conceptual ideas that Essbase is famous for
As we've said many times before, Essbase is an art, not a science! The idea of how
to determine the order of calculation is made up of equal parts of scientific blah,
blah, blah about, "Well this is how Essbase is written so this is how it works",
and generous portions of, "I kept tweaking the script or the outline until I got
the results I needed."
Trang 4Isn't that great? How do I figure out something like that? Well, here is how
it's supposed to work:
1 During a CALC ALL database calculation, Essbase will calculate your
dimension tagged as Accounts first
2 Next will be the dimension you have tagged as Time
3 Then, Essbase will calculate the remaining Dense dimensions in the order
they appear in the EAS outline viewer (top to bottom)
4 Finally, Essbase will calculate the remaining Sparse dimensions again,
in the order they appear in the EAS outline viewer (top to bottom)
5 If you do not have a Time dimension or an Accounts dimension, Essbase
seems to calculate the DenseDimension (top to bottom) first
6 Then, Essbase will finish up with the Sparse dimensions (top to bottom)
Now, within each dimension, the order of calculation is supposed to work like this:
1 First, consolidations are performed as per the Member Properties settings
(formulas and rollups) for the level zero members of all of the branches in
the dimension currently being calculated
2 The calculations continue rolling up the data to Level 1, then to Level 2,
and so on, until the entire dimension has been calculated
Notice the different levels in the TOTAL MARKET dimension in the preceding
screenshot On expanding the UNITED STATES OF AMERICA market, you see
the lowest or zero level members appear to be states Then, next up are regions,
and finally the United States market itself When we talk of rolling up data, this is
what we mean The database outline is set up so the states add up into the regions
Trang 5What's that you say? This ordering of calculation will never work for us because
we need to have the Model Year dimension and the Market dimension rolled up
first before we calculate the Accounts dimension Plus we do not want to mess
with the ordering of the dimensions in the outline! What do we do?
Well, that is why you write yourself a custom Essbase database calculation
script and control the order of calculation exactly the way you want it
Two-Pass Calc
Because of how Essbase stores the data and the order it is calculated, there is an
occasional need for this cool function
You see, sometimes, a data component in the calculation of one data value has not
been calculated at the time the system needs it This is because some component
pieces of data are dependent on other data values being calculated prior to their
use in another calculation Essbase has recognized that the data may need to be
calculated once to produce the correct values at one level, and then the component
data is calculated again to produce the correct values at another level
The option to set the Two-Pass attribute is only available on Outline members
in the Accounts dimension that are tagged as Dynamic Calc or Dynamic Calc
and Store.
As usual, Essbase has a good reason why this is available on Dynamic Calc and
Dynamic Calc and Store members It is because when you write your own custom
database calculation script, you are in complete control of the order of calculation
Dynamic calculation members also follow a slightly different methodology when
calculating than calculation scripts and database calculations Dynamic calculation
members, in general, do not follow the dimension order of the outline as non-dynamic database members do
A good tip to remember when writing calcs is to pay close attention to,
and code for, the correct order the data needs to be calculated in
For example, if you want to see how many total vehicles were sold in
a given market and across time (months, quarters, years), you want to
make sure you have rolled up sales across the Vehicles dimension as well
as the Market dimension, before you rollup the Calendar Periods
dimension See how easy that is?