Technical data

Creating Rules, Formul as, and User Functions Chapter 10
Circular Reference
If a data cube’s
formula refers directly or indirectly to a current value of the same data cube, the analytic
calculation e
ngine generates a circular reference error. Following are some examples of circular references:
Case 1
A=A+B
When the analytic calculation engine evaluates the formula A + B, the analytic calculation engine changes the
value of A. Then, the analytic calculation engine m ust evaluate the formula again, using the new value of A,
consequently changing the value of A again. For this reason, the analytic calculation engine must evaluate
the formula again, and so on. Because the analytic calculation engine does not contain a method to exit this
cycle, it refuses to accept a formula that contains a circular reference.
This formula contains a direct circular reference because A refers to itself in its own formula.
Case 2
A=B+C
B=A+D
This case is slightly more complex, but is a result of the same issue presented in Case 1. When the analytic
calculation engine evaluates the formula B + C, the analytic calculation engine changes the value of A. The
analytic calculation engine must then evaluate the formula A + D, using the new value of A, consequently
changing the v alue of B. For this reason, the analytic calculation engine must re-evaluate B + C, consequently
changing the value of A. For this reason, the analytic calculation engine must re-evaluate A + D, and so
on. These two formulas create an endless circle.
These formul
as c ontain an indirect circular reference because neither A nor B refers t o itself in its own
formula. In
stead, the circularity is created by the two formulas working together. The following statement
describes t
his circularity: A depends on B, which depends on A.
Case 3
A=B+C
B=D+E
D=F+G
F=A+H
In this case, A depends on B, which depends on D, which depends on F, which depends on A.
The analytic calculation engine traps all circular errors and does not allow you to inadvertently create circular
references. Though this is the case, you may have to rethink the logic of the analytic model to ensure proper
calculation. A circular reference is often the result of a logical error, which is an attempt to define something
in terms of itself. If you encounter a circular reference error, you may need to step through the formulas in
the analytic model definition to discover where the thinking is circular. Once you find this answer, you must
rework the logic to remove the circularity.
A circular r
eference error occurs when a data cube directly or indirectly refers to a current value of itself. On
the other h
and,ifadatacubereferstoapreviousvalueofitself, the formula is not only valid but useful.
See C
hapter 11, “Using Built-in Functions in Analytic M odels,” PREVSELF, page 183.
See C
hapter 10, “Creating Rules, Formulas, and User Functions,” Working with Circular Formulas and
Circular Systems, page 134.
118 Copyright © 1988-2007, Oracl e. All rights reserved.