![]() Previous |
![]() Next |
When a model contains an assignment statement to assign data to a dimension value, then the dimension is limited temporarily to that value, performs the calculation, and restores the initial status of the dimension.
For example, a model might have the following statements.
DIMENSION line gross.margin = revenue - cogs
If you specify actual
as the solution variable when you run the model, then the following code is constructed and executed.
PUSH line LIMIT line TO gross.margin actual = actual(line revenue) - actual(line cogs) POP line
The fact that using a solution variable in a model causes this behind-the-scenes code construction allows you perform complex calculations with simple model equations. For example, line item data might be stored in the actual
variable, which is dimensioned by line
. However, detail line item data might be stored in a variable named detail.data
, with a dimension named detail.line
.
When your analytic workspace contains a relation between line
and detail.line
, which specifies the line item to which each detail item pertains, then you might write model equations such as the following ones.
revenue = total(detail.data line) expenses = total(detail.data line)
The relation between detail.line
and line
is used automatically to aggregate the detail data into the appropriate line items. The code that is constructed when the model is run ensures that the appropriate total is assigned to each value of the line
dimension. For example, while the equation for the revenue
item is calculated, line
is temporarily limited to revenue
, and the TOTAL
function returns the total of detail items for the revenue
value of line
.