In formulas it is possible to calculate with the properties or values for a characteristic (such as a key, an external attribute of the key, an attribute value, or a hierarchy attribute). In doing so, the formula is replaced, depending on the cell context.
For example, the basic characteristic Sales Quantity multiplies with the current value for the attribute Price for the characteristic Material. You can reach this with the corresponding, defined formula variable: Processing type Replacement Path, replacement from characteristic Material, replace variable with Attribute Value: Attribute Price.
The replacement of formula variables with the processing type Replacement Path acts differently in calculated key figures and formulas:
Note that the calculation before the aggregation can impair performance.
Replacement from the Value of an Attribute
With formula variables you can set the processing type Replacement from the Value of an Attribute and create a reference to the reference characteristic for the variable. The attribute Reference to Characteristic (Constant 1) is a dummy attribute that is available with each characteristic. It serves to create a reference to the characteristic, by which it does not need to be aggregated. By choosing this attribute, you can influence the aggregation behavior of calculated key figures in a targeted way and can improve performance during calculation.
Example for calculating with variables for process type Replacement from the Value of an Attribute:
Master data table for material
InfoCube
In the example query there are the following objects:
Material Price (V1) is a variable that is replaced by the material price.
K1 = Material Price (V1) is a calculated key figure.
F1 = Material Price (V1) is a formula.
K2 = Material Price (V1) * Sales Quantity is a calculated key figure.
F2 = Material Price (V1) * Sales Quantity is a formula.
K3 = K1 * Sales Quantity is a calculated key figure in which the calculated key figure K1 is further processed.
Query View 1
Query View 2
In the results rows the columns F1 and F2 are not specified, because the material value is not unique. Also, the system cannot calculate F1 and F2 in the overall Query View 2. K1 only aggregates the prices and K3 multiplies these aggregated prices with the aggregated sales quantities. Usually the results from K1 and K3 have no meaning. The calculated key figure K2 delivers the desired results.