Databases Reference
In-Depth Information
Very Important!
Since this is your first calculation function that you are learning
about, we should give you this tip right now. The correct syntax
for all calculation functional statements, in both scripts and
formulas, is to end the statement with a semi-colon (
;
). Some
statements are not required to end with a semi-colon, like
conditional statements (
if
,
else
,
endif
), but all actionable
statements are.
Calculate/Aggregate dimension
With an understanding of the
Calc All
function, we can now be comfortable
describing the two very useful and related database calculation script functions.
Where the
Calc All
function is used to calculate the entire database based on the
outline (consolidations and stored member formulas), the
CALC DIM
and
AGG
functions are used to perform almost the same function with dimension level precision.
The
CALC DIM
function performs exactly like the
Calc All
function in that it will
execute calculations based on the database outline and
Store Data
tagged member
formulas, with one huge difference. In calculating, functionality is constrained to
only the database dimensions you list with this function. The following is an
example of how you would code a
CALC DIM
statement to calculate only the
Calendar Periods
dimension.
To
CALC DIM
one dimension:
CALC DIM("Calendar Periods");
To
CALC DIM
more than one dimension in one command:
CALC DIM("Calendar Periods","Model Year","Market");
To make sure a specific order is followed:
CALC DIM("Market");
CALC DIM("Model Year");
CALC DIM("Calendar Periods");
The parameter section of this function can contain a comma separated list if you
wish to calculate more than one dimension.
If you need to ensure a specific order of calculation for the dimensions, it is best
to code individual
CALC DIM
statements containing only one dimension name
in the order you need them to be calculated for each dimension.