Technical data

Chapter 11 Using Built-in Functions in Analytic M odels
PCT_RECV_IN_2_MONTHS * PREV(MONTHS, SALES, 3)
TOTAL_MONTHLY
_RECEIPTS data cube formula:
RECV_IMMEDIAT
ELY + RECV_IN_1_MONTH + RECV_IN_2_MONTHS + RECV_IN_3_MONTHS
RECV_IMMEDIATELY contains the amount received from the current month’s sales, RECV_IN_1_MONTH
contains the amount received from the previous month’s sales, and so on. Add all of these amounts together to
calculate the total receipts for the month.
PREVSELF
Syntax
PREVSELF(Dimension, {Start Value}, {Count})
Description
The PREVSELF function returns the value of the current data cube from Count members back in Dimension.
When the program is calculating the first Count members of Dimension, PREVSELF returns Start Value.If
Start Value is omitted, it is assumed to be 0. If Count is omitted, it is assumed to be 1.
Note. The PREVSELF function operates on detail m ember names that are persisted in the main record. This
function does not use trees to determine the order of members.
Returns
The PREVSELF function returns the value of the current data cube from Count members back in Dimension.
When the program is calculating the first Count members of Dimension, PREVSELF returns Start Value.If
Start Value is omitted, it is assumed to be 0. If Count is omitted, it is assumed to be 1.
Example
Suppose that you want to forecast sales. For each month, you want to add an estimated Sales Growth to the
previous month’s sales. When calculating the first month, you wa nt to add sales growth to starting sales. You
can do this with the following formula for the SALES cube:
PREVSELF(MONTHS, STARTING_SALES) + SALES_GROWTH
For the first
month, this formula returns the starting sales plus sales growth. For every other month, the
formula ret
urns the previous month’s sales plus sales growth.
The PREVSELF function is useful for keeping a running balance of transactions. For example, suppose that
an analytic model contains monthly data cubes called DEPOSITS, WITHDRAWALS, and BALANCE,
and a single value data cube called START_BALANCE. You can calculate the BALANCE cube with
the following formula:
PREVSELF(M
ONTHS, START_BALANCE) + DEPOSITS - WITHDRAWALS
This formula calculates the ending balance for eachmonthbyaddingDEPOSITSandsubtracting
WITHDRAWALS from the ending balance for the previous month. Because no previous balance is available
for the first month, the PREVSELF function returns the value of Start Balance.
Copyright © 1988-2007, Oracl e. All rights reserved. 183