CALCULATE ROW

Creates a named row and associates it with a row name or label. This is similar to declaring a variable. This command can also specify an operation (+, _, *, /, or OFF) as an equation consisting of constants, other calculated rows, and operators.

Equations are evaluated at the time of declaration. If an operator is specified, subsequent output rows have the operator applied to them with the result stored in the calculated row.

This is useful for aggregating a series of rows to obtain a subtotal or total. The operator can be reset at any point with SETROWOP. If neither an equation nor an operator are specified in the CALCULATE ROW command, the + operator is assumed.

SETROWOP defines a calculation operator to be applied to all subsequent output data rows. Use PRINTROW to display the calculation results in the newly created row.

Syntax

1:

{ CALCULATE ROW "newRow" [ columnNo ] = expression }

2:

{ CALCULATE ROW "newRow" [ operator ]}
ParameterDescription

"newRow"

Name of a new row, enclosed by quotation marks, that was declared with SAVEROW or SAVEANDOUTPUT.

columnNo

Optional. Column numbers to which Essbase applies the expression.

expression

Row calculation expression. Member names are not supported.

operator

One of the following mathematical operators:

  • + Addition.

  • - Subtraction.

  • * Multiplication.

  • %X%Y X as a percentage of Y.

  • / Division.

  • OFF Turns off the row operator.

If omitted, the default is + (add).

Notes

Example

The following samples demonstrate row calculations that you can perform. Note that "Total Sales" in the examples represent a calculated row, not a member name.

To compute "Avg Sales" by dividing by the constant 2:

{ CALCULATE ROW "Avg Sales" = "Total Sales" / 2 }

To multiply the first six data columns of the calculated row "Total Sales" by the six factors and store the result in the calculated row "Factored Sales":

{ CALCULATE ROW "Factored Sales" = "Total Sales" * [1.0 1.3 1.9 2.3 3.0
3.7 ] }

To store five factors in the first five columns of "Factors", for use in later calculated row computations and/or PRINTROW output:

{ CALCULATE ROW "Factors" = [ 1.3 2.6 3.1 2.3 5 ] }

To store the value from the seventh column of "Total Sales", multiplied by 1000, in every column of the calculated row "Ending Sales":

{ CALCULATE ROW "Ending Sales" = "Total Sales" 7 * 1000 }

To set the value in column 7 of "Ending Sales" to the corresponding value from the row "Total Sales":

{ CALCULATE ROW "Ending Sales"7 = "Total Sales" }

"Total" refers to itself in this calculation and divides itself by 1000:

{ CALCULATE ROW "Total" = "Total" / 1000. }

To show a variety of operations used in one expression, use an expression like this:

{ CALCULATE ROW "xyz" = [ 11 12.3 -6 ] / 7 + "abc"2 % 4300. + 10 }

This expression divides the three values in the array by the constant 7 (if there are currently more than three data columns, the extra columns remain #Missing), adds the value from column 2 of "abc" to every column, and computes the resulting row's values as percentages of the constant 4300, and adds the constant 10 to all columns, storing the final result in "xyz". Note that if there are more than three data columns, the result in the extra columns is 10, since prior to the last operation, they were #Missing.

See Also