In Query Designer, you use formulas to recalculate the key figures in an InfoProvider so that you can reuse them. Calculated key figures consist of formula definitions containing basic key figures, restricted key figures or precalculated key figures.
Defining a New Calculated Key Figure
If a calculated key figure has already been defined for this InfoProvider, you can select the Calculated Key Figures entry and choose New Calculated Key Figure from the context menu.
The system adds the New Calculated Key Figure entry. The properties for the calculated key figure are displayed in the Properties screen area.
The Calculated Key Figure dialog box appears.
You can also call the Change Calculated Key Figure dialog box from the Properties screen area by choosing the Edit pushbutton.
You make the basic settings on the General tab page.
The upper part of the screen contains a text field, where you can enter a description for the calculated key figure.
You can use text variables in the description.
You can also enter a technical name in the Technical Name field.
Below this is the input field for the formula that you want to use to calculate the key figure. The area to the bottom left contains all the operands available for defining the formula. These are:
On the right of the screen, the system displays the functions that can be used as operators:
Above these two areas, the symbols for basic arithmetical operations are displayed. To the right, there is a numeric pad.
To define a formula, proceed as follows:
You can also enter digits, parentheses and basic arithmetical operations using the keyboard.
The system does not check whether the formula makes sense semantically, for example, if it contains the same units. Semantic checks are performed with the Check Query function. You call this function in the Query Designer Toolbar.
If you want to use a variable that is not contained in the operands while defining a formula, you first need to create the variable. Highlight the Formula Variable entry and choose New Formula from the context menu. The Variables Wizard now appears. This guides you step-by-step through the process for defining a new variable.
If you want to change a formula variable, select the variable and choose Edit from the context menu. The Variables Editor appears.
Note that when you execute a query, the key figures are always calculated as the same unit. A formula is semantically incorrect if you add a currency unit (such as EUR) with a weight unit (such as kg) for example. If you want to calculate values regardless of the unit, use the Value Without Dimension (No Unit) function. See Data Functions.
Editing Calculated Key Figures
When you change a calculated key figure, note that these changes take effect in all queries that use the calculated key figure.
You can see where the calculated key figure is used. Choose Where-used List from the context menu for the calculated key figure.
You can also call the Change Calculated Key Figure dialog box from the Properties screen area by choosing the Edit pushbutton.
Defining Properties for the Calculated Key Figure
You have defined a calculated key figure for reuse. You can use this calculated key figure in all queries based on this InfoProvider by moving the key figure into the rows or columns of the query using drag and drop. The calculated key figure is not an actual element of this query, but a placeholder that references the calculated key figure in the InfoProvider.