Maintaining Calculated Key FiguresYou maintain the calculated key figures in an aspect in the EC-EIS application menu under . To create or change a key figure, proceed as follows.
Enter the aspect whose key figure you wish to maintain. Choose
Edit key figures
.
Enter the name of a new key figure or that of an existing key figure. Choose
or
Change.
Maintain the short text and description, and enter a formula. The components of the formula should be separated with blank spaces.
Example
Formula |
Description |
REVEN - COST |
Normal subtraction |
REVEN MAX COST |
Maximum of REVEN and COST |
REVEN %A COST |
COST as percentage of REVEN |
REVEN + ABS (COST) |
Sum of REVEN and the absolute COST amount |
Using the function
, you can display the possible components for the formula. Using the function
Switch basic fields
, you can switch between basic key figures, existing key figures and constants. For more information on constants, see
Creating Constants
.
The following operators are supported in the formula:
Operator |
Description |
+, -, *, / |
Basic arithmetic operations |
% |
Percentage variance (i.e. a % b = 100 * (a-b) / abs(b)) |
%A |
Percentage (a %A b = 100* a/b) |
%T |
Percentage of the total sum 1 |
%S |
Percentage of the sum |
** |
Raise to a power |
= |
Assignment |
ABS |
Absolute amount |
CNT |
1 if operand <> 0, otherwise 0 |
COS |
Cosine |
DIV |
Division (of integers) |
DTA |
Jump function. 1 if operand is 0, otherwise 0 |
EXP |
Exponential function |
LOG |
Logarithm |
MAX |
Maximum |
MX0 |
Maximum of operand and zero |
MIN |
Minimum |
MN0 |
Minimum of operand and zero |
MOD |
Remainder (of division of integers) |
NDI |
Key figure value without dimension |
REF |
Value 1 without dimension 2 |
SIN |
Sine |
SQT |
Square root |
Key:
This operator can only be used when maintaining forms for drilldown reports. Total sum means the value in the results row when aggregated over all the characteristics.
This operator can only be used when maintaining forms for drilldown reports. Sum means the value in the results row for the current drilldown.
Choose to delete and insert lines in the formula area.
Note
Key figure formulas may be up to 4,096 bytes long. Note that key figures in the info system are broken down internally.
Before saving the formula, you must choose . The formula is then checked for correct syntax, the formula stages are generated, and the technical attributes are set to default values. The formula stages represent the breakdown of the key figure formula into elementary calculation steps (stages). After the syntax check, the key figures are checked for their logical sense. A check is made, for example, that quantities are not added to values.
You can use the function to reset the key figure to the version stored in the database or the last saved version.
Choose to replace the key figures with the elements defining them until the formula contains only basic key figures and constants.
Choose to display or hide the formulas for the key figures in the lower section of the formula area. You can specify the key figures by entering the name or subgroup.
Use the function to switch between the upper and lower formula areas.
Choose to check whether recursive relationships exist between key figures.
is for internal test purposes only.
The function
acts as a calculator. You can enter values in the basic fields (
Enter basic values
) and then have the system calculate the key figure values from the formulas (
Calculate key fig.
). The system displays the calculated values on the formula stage screen (
). You may have to switch between the value and attribute display (
).
Choose the function
Formula stages
to branch to another screen. Here, the calculation stages for the key figure are displayed. In addition, you can set the time-based and non-time-based aggregation rules, the time reference field, the
No aggregation required
indicator and the number format (number of decimal places and display factor).
An attribute of key figures, important for their use in presentation, is the aggregation rule assigned to the key figures. This determines if and how the individual key figures are to be aggregated over characteristics in a report. There are two types of aggregation for basic key figures:
Time-based aggregation rules define how a key figure is to be aggregated over time. In the following example, it would not make sense to add the number of employees for each period over several periods, but it may be useful to calculate the average. With stock prices, the maximum, minimum, and average within a period are of interest, but not the sum. To calculate non-cumulative values such as these, you need to specify a reference field, that is, the smallest time unit in the aspect. The key figure must be posted for each characteristic value defined for this reference field, in this case, number of employees each month.
Non-time-based aggregation defines how the key figure is to be summarized over a characteristic that is not a time dimension. In the following example, the number of employees is totaled over the cost centers because the characteristic cost center has no time dimension.
You can maintain a non-time-based and a time-based aggregation rule for each key figure.
Example
Basic key figure Number of employees is defined as:
Field name |
Description |
Aggregation |
Time-based aggr. |
Ref. field |
EMPLY |
No. of employees |
SUM |
AVG |
&PERI |
The number of employees must be posted each month ( &PERI ).
This basic key figure is then used in a basic report.
Period |
No. of employees |
|
001.1995 |
10 |
|
002.1995 |
15 |
|
003.1995 |
35 |
|
Result |
20 |
(Average value) |
If you drill down period 2 by cost center, the list appears as follows:
Cost center |
No. of employees |
|
010 |
5 |
|
020 |
7 |
|
030 |
3 |
|
Result |
15 |
(Total) |
The following functions are available for time-based aggregation:
Function |
Description |
AVG |
Average |
CNT |
Counter |
FIR |
First value |
LAS |
Last value |
MAX |
Maximum |
MIN |
Minimum |
NOP |
No aggregation |
SC+ |
Summation where > 0 |
SC- |
Summation where < 0 |
STD |
Standard deviation |
SUM |
Summation |
VAR |
Variance |
The following functions are available for non-time-based aggregation:
Function |
Description |
MAX |
Maximum |
MIN |
Minimum |
NOP |
No aggregation |
SC+ |
Summation where > 0 |
SC- |
Summation where < 0 |
SUM |
Summation |
If you define a time-based aggregation rule other than
SUM
for a key figure, you must maintain a
time reference field
. This must be a valid characteristic of type D as well as being the smallest unit of time in the aspect (You can use the variable
&PERI
delivered by SAP which represents the fiscal year and the period.) The time reference field must be the most precise time field in the aspect. According to this rule, the field
Posting date
would supersede
Fiscal year
.
All key figures in a report must have the same time reference field.
Note
Where a basic key figure has a time-based aggregation rule other than
SUM
, it cannot be used to create calculated key figures with another aggregation rule. This means, for example, that to create a key figure
Maximum warehouse stock
with time-based aggregation
MAX
and time reference field
&PERI
which stores the maximum warehouse stock per period, it is necessary to define the key figure
Warehouse stock
with time-based aggregation
SUM
and the key figure
Average warehouse stock
with time-based aggregation
AVG
and time reference field
&PERI
.
Set the
No aggregation required
indicator if the key figure cannot be aggregated in a report from the rows or columns before it. For example,
sales revenue per employee
for all plants cannot be calculated from the relevant key figures for the individual plants, but rather must be calculated using the cumulated revenue and the total of all employees. The collective key figure must be calculated in the results row on the basis of a new formula.
Example
Month |
Sales |
Employees |
Sales/Employee |
Plant 1 |
100 |
1000 |
0,1 |
Plant 2 |
1000 |
100 |
10 |
Result |
1100 |
1100 |
10.1 or 1? |
In the above example, it is important that the results row is not calculated like the other rows (sales divided by employees) but that it is calculated using a formula defined for the cell.
The
No aggregation required
indicator must be set when
Operators other than = , + and - are used in the key figure
The
No aggregation required
indicator is set in a key figure used in the formula
A time-based or non-time-based rule other than SUM is used in any basic or calculated key figure used in the formula.
You can create key figure groups and assign key figures to these groups You can use these key figure groups in the report definition in order to simplify the selection of key figures. Before you assign a key figure to a key figure group during key figure maintenance, you must first have created key figure groups in Customizing.