Show TOC Start of Content Area

Procedure documentation Defining Calculated Key Figures  Locate the document in its SAP Library structure

Use

In the 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.

Procedure

Defining a New Calculated Key Figure

...

       1.      In the InfoProvider screen area, select the Key Figures entry and from the context menu (secondary mouse button click), choose 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, from the context menu, choose New Calculated Key Figure.

The system adds the New Calculated Key Figure entry. The properties for the calculated key figure are displayed in the Properties screen area.

       2.      Select the New Calculated Key Figure entry and, from the context menu (secondary mouse button), choose Edit.

The Calculated Key Figure dialog box appears.

Note

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 in which you enter a description of the calculated key figure.

Note

You can use text variables in the description (for more information, see Using Text Variables).

Next to that, you can enter a technical namein the Technical Name field.

Below this is the input field for the formula that you want to use to calculate the key figure. The bottom left screen area contains all of the operands available for defining the formula. These are:

       The basic key figures, calculated key figures and restricted key figures from the relevant InfoProvider

       All formula variables

On the right side of the screen, you see the functions that are available as operators:

       Basic functions

       Percentage Functions

       Data Functions

       Mathematical functions

       Trigonometric functions

       Boolean Operators

Above these two areas, you see the symbols for the basic arithmetic operations. To the right there is a number block.

Proceed as follows to define a formula:

       Choose the required operands and insert them in the Detail View field by double-clicking or by using drag and drop.

       Choose the calculation functions you want to use by either clicking on the symbols for the basic arithmetic operations, double-clicking on the functions, or using drag and drop.

       Select the numerical values for the formula by clicking on the number block.

Note

You can also enter digits, parentheses and basic arithmetical operations using the keyboard.

       3.      Define your formula using the available operands and operators. With each step, the system checks the syntactic correctness of the formula. If the formula is not yet complete or is not syntactically correct, the system underlines the location of the error in red.

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 menu bar (for more information, see Functions of the Menu Bar in the Query Designer).

Note

If, when defining a formula, you want to use a variable that is not contained in the operands, you must first create the variable. Highlight the Formula Variable entry and, from the context menu, choose New Formula. You reach the variable wizard. This takes you through a step-by-step process for defining a new variable.

If you want to change a formula variable, select the variable and, from the context menu, choose Edit. The variable editor appears.

Caution

Note that when you execute a query, the key figures are always calculated as the same unit. A formula is semantically incorrect, for example, when you add a currency unit (such as EUR) with a weight unit (such as kg). If you want to calculate values regardless of the unit, use the function Value Without Dimension (Without Units). See Data Functions.

       4.      Enter a description for the calculated key figure.

       5.      On the other tab pages, make any required settings for the properties of the calculated key figure. See Selection/Formula Properties.

       6.      Choose OK. The new calculated key figure is defined for the InfoProvider.

Editing Calculated Key Figures

Caution

Note that when you change a calculated key figure, these changes are effective in all queries that use the calculated key figure.

Note

You can see where the calculated key figure is used. Choose Where-used List from the context menu (secondary mouse click).

...

       1.      In the InfoProvider screen area, select the calculated key figure and, from the context menu (secondary mouse button), choose Edit.

Note

You can also call the Change Calculated Key Figure dialog box from the Properties screen area by choosing the Edit pushbutton.

       2.      Make the required changes to the formula definition or in the properties on the corresponding tab page.

       3.      Choose OK.

Determining Properties for the Calculated Key Figure

...

       1.      Select the calculated key figure. The properties dialog box is displayed in the Properties screen area.

       2.      Make the required settings for the description, display, number format, currency translation, local calculations and aggregation behavior of the calculated key figure. See Selection/Formula Properties.

Result

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; it is a placeholder that references the calculated key figure in the InfoProvider.

 

 

End of Content Area