Professional Documents
Culture Documents
Aggregation
Lothar Schubert, BW RIG
SAP Labs America, LLC
March 2003
Business
Explorer
Master Data
MultiProvider
No Data
ODS Object
Virtual
InfoCube
InfoSet
SAP AG 2002, Title of Presentation, Speaker Name
InfoProvider Interface
With Data
Basic
InfoCube
OLAP
Engine
Overview
KF/CKF Properties and Exception Aggregation
OLAP Processor Under the Hood
Case Study Revenue Calculation
Calculation with Reference to Characteristic
Formula Collision
Percentage and Summary Functions
Overview
KF/CKF Properties and Exception Aggregation
OLAP Processor Under the Hood
Case Study Revenue Calculation
Calculation with Reference to Characteristic
Formula Collision
Percentage and Summary Functions
Example:
Department Headcount
D1
100
D2
80
Result
180 << SUM
Month
Headcount
1/3/03
160
2/3/03
180
Result
170 << AVG, with regards to Month
Dr
illd
ow
Aggregate values
using standard
aggregation
n
Aggregate values
using exception
aggregation
Drill-down by Material
explains result
309 = ( 225 + 20 + 630
+ 360) / 4
Plant
Result
10
11
12
Overview
KF/CKF Properties and Exception Aggregation
OLAP Processor Under the Hood
Case Study Revenue Calculation
Calculation with Reference to Characteristic
Formula Collision
Percentage and Summary Functions
13
OLAP Initialization
Check Authorizations
Is it ok to execute query?
Is it ok to read data from InfoProvider?
Process Variables
Exit for global variables (before variable input) is processed
Prompt for variable input
Exit for global variables (that failed before input) is processed
Variable values are distributed to fixed filter, hierarchy settings, dynamic
filter, conditions & exceptions, formulas,
14
15
16
17
Overview
KF/CKF Properties and Exception Aggregation
OLAP Processor Under the Hood
Case Study Revenue Calculation
Calculation with Reference to Characteristic
Formula Collision
Percentage and Summary Functions
18
KH_ATTRIBUTE_REPLACEMENT
Calendar year
Key Figures
KHMAT2
KHMAT2
M1
M2
Overall Result
Quantity
11.000 PC
15.000 PC
26.000 PC
KH_ATTRIBUTE_REPLACEMENT
Calendar year
Key Figures
KHMAT2
Calendar year
2001
2002
Overall Result
Quantity
12.000 PC
14.000 PC
26.000 PC
19
InfoCube Definition
20
Price Attributes
InfoCube Definition
21
Data
InfoCube
Material Master
22
Crea
te
23
Formula Editor
KHMAT2
M1
M2
Overall Result
Quantity
Calendar year
2001
2002
Overall Result
Quantity
24
11.000 PC
15.000 PC
26.000 PC
'KHF1' * 'Quantity'
$ 110.00000 PC
$ 300.00000 PC
X
12.000 PC
14.000 PC
26.000 PC
'KHF1' * 'Quantity'
X
X
X
Cre
ate
Price
25
Query Definition
Quantity
KHMAT2
M1
M2
Overall Result
11.000 PC
15.000 PC
26.000 PC
Quantity
Calendar year
2001
2002
Overall Result
12.000 PC
14.000 PC
26.000 PC
26
KHK1_BEFORE
$ 20.00
$ 40.00
$ 60.00
KHK1_BEFORE
$ 30.00
$ 30.00
$ 60.00
Material
M1
M1
M2
M2
Year
Material
M1
M2
Result
Year
Quantity
2001
2001
2002
2002
Price
5
6
7
Quantity Price
11
15
26
10
10
20
20
40
60
Quantity
KHMAT2
M1
M2
Overall Result
Calendar year
2001
2002
Overall Result
11.000 PC
15.000 PC
26.000 PC
Quantity
12.000 PC
14.000 PC
26.000 PC
27
KHK1_AFTER
$ 10.00
$ 20.00
$ 30.00
KHK1_AFTER
$ 30.00
$ 30.00
$ 30.00
Material
M1
M2
Year
Quantity Price
2001
11
2001
15
Material
M1
M2
Result
Year
Quantity Price
11
15
26
10
20
30
Quantity
KHMAT2
M1
11.000 PC
M2
15.000 PC
Overall Result 26.000 PC
KHK1_AFTER
$ 10.00
$ 20.00
$ 30.00
'Quantity' * 'KHK1_AFTER'
$ 110.00000 PC
$ 300.00000 PC
$ 780.00000 PC
Calendar year
Quantity
2001
12.000 PC
2002
14.000 PC
Overall Result 26.000 PC
KHK1_AFTER
$ 30.00
$ 30.00
$ 30.00
'Quantity' * 'KHK1_AFTER'
$ 360.00000 PC
$ 420.00000 PC
$ 780.00000 PC
Qu * Pr = Formula
Material
M1
M1
M2
M2
Year
Price
Qu * Pr
Material
M1
M2
Result
Year
Quantity Price
11
15
26
Qu * Pr
10
20
30
Material
M1
M2
Result
Year
Quantity Price
11
15
26
Qu * Pr
10
110
20
300
30
780
28
2001
2002
2001
2002
5
6
7
8
Year
Material
Year
Result
Quantity
Qu * Pr = Formula
Quantity
2001
2002
2001
2002
Price
Qu * Pr
5
6
7
8
Quantity Price
2001
12
2002
14
26
Qu * Pr
30
360
30
420
30
780
29
Quantity
KHMAT2
M1
11.000 PC
M2
15.000 PC
Overall Result 26.000 PC
Quantity
Calendar year
2001
12.000 PC
2002
14.000 PC
Overall Result 26.000 PC
30
Material
M1
M1
M2
M2
Year
Material
M1
M2
Result
Year
Qu * Pr = CKF
Quantity
2001
2002
2001
2002
Price
Qu * Pr
5
6
7
8
Quantity Price
11
15
26
10
20
30
Qu * Pr
110
300
410
e.g. = Price
e.g. = Price / Quantity
In case of MultiProviders
Datasets are processed individually per InfoProvider first
Quantity
11.000 PC
15.000 PC
26.000 PC
KHK1_BEFORE
$ 20.00
$ 40.00
$ 60.00
KHK1_AFTER
$ 20.00
$ 40.00
$ 60.00
Calendar year
2001
2002
Overall Result
Quantity
12.000 PC
14.000 PC
26.000 PC
KHK1_BEFORE
$ 30.00
$ 30.00
$ 60.00
KHK1_AFTER
$ 30.00
$ 30.00
$ 60.00
31
Overview
KF/CKF Properties and Exception Aggregation
OLAP Processor Under the Hood
Case Study Revenue Calculation
Calculation with Reference to Characteristic
Formula Collision
Percentage and Summary Functions
32
Motivation
Mostly, the OLAP first aggregates data and then applies
calculations
Sometimes you would like to change this sequence
(however you do not want to use before aggregation for all
characteristics combinations, due to performance reasons)
Example Cube Data:
33
34
35
36
Overview
KF/CKF Properties and Exception Aggregation
OLAP Processor Under the Hood
Case Study Revenue Calculation
Calculation with Reference to Characteristic
Formula Collision
Percentage and Summary Functions
37
Formula Collision
*'Quantity' * 'Quantity'
Quantity
2001
12.000 PC
2002
+14.000 PC
Summary
26 PC
Quantity
12.000 PC
14.000 PC
26 PC
Quantity
2001
12.000 PC
2002
14.000 PC
Summary
26 PC
Quantity
12.000 PC
14.000 PC
26 PC
'Quantity' * 'Quantity'
144.00000 PC^2
196.00000 PC^2
676.00000 PC^2
Quantity
2001
12.000 PC
2002
14.000 PC
Summary
26 PC
Quantity
12.000 PC
14.000 PC
26 PC
'Quantity' * 'Quantity'
144.00000 PC^2
196.00000 PC^2
340.00000 PC^2
144.00000 PC^2
196.00000 PC^2
676.00000 PC^2
38
Overview
KF/CKF Properties and Exception Aggregation
OLAP Processor Under the Hood
Case Study Revenue Calculation
Calculation with Reference to Characteristic
Formula Collision
Percentage and Summary Functions
39
difference in percentage:
How much does a value deviate from the absolute amount of b: = (a-)/abs(b)?
a%Ab
share in percentage:
%CTa
The value of the key figure a is related to the next higher value that is aggregated (the
"subresult" of a with respect to a characteristic is 100%).
GTa
The value of the key figure a is related to the aggregated value for all characteristics (the
"result" of the entire table for the key figure a is 100%).
%RTa
The value of the key figure a is related to the aggregated value for all characteristics, for
which the dynamic filter is ignored. If, for example, a free characteristic is restricted by a
filter value, the global result of the key figure a in the displayed table is not 100%. The
aggregation via all filter values results in 100%.
40
Overall Result
Calendar year
Quantity
2001
5.000 PC
2002
6.000 PC
Result
11.000 PC
2001
7.000 PC
2002
8.000 PC
Result
15.000 PC
26.000 PC
KHMAT2
M1
M2
Calendar year
Quantity
2001
5.000 PC
2002
6.000 PC
Overall Result 11.000 PC
'Quantity' % 10
-50.00000 %
-40.00000 %
10.00000 %
'Quantity' % 10
-50.00000 %
-40.00000 %
10.00000 %
-30.00000 %
-20.00000 %
50.00000 %
160.00000 %
'Quantity' %A 10
50.00000 %
60.00000 %
110.00000 %
70.00000 %
80.00000 %
150.00000 %
260.00000 %
%CT 'Quantity'
45.45455 %
54.54545 %
42.30769 %
46.66667 %
53.33333 %
57.69231 %
100.00000 %
%GT 'Quantity'
19.23077 %
23.07692 %
42.30769 %
26.92308 %
30.76923 %
57.69231 %
100.00000 %
'Quantity' %A 10
50.00000 %
60.00000 %
110.00000 %
%CT 'Quantity'
45.45455 %
54.54545 %
100.00000 %
%GT 'Quantity'
45.45455 %
54.54545 %
100.00000 %
%RT 'Quantity'
19.23077 %
23.07692 %
42.30769 %
%RT 'Quantity'
19.23077 %
23.07692 %
42.30769 %
26.92308 %
30.76923 %
57.69231 %
100.00000 %
a%b
difference in percentage
a%Ab
share in percentage
%CTa
GTa
%RTa
41
Summary Functions
SUMGTa
The value of the key figure a is related to the aggregate value via all characteristics.
Aggregation is completed using the deepest-level characteristic.
SUMCTa
The value of the key figure a is related to the next highest aggregate value.
SUMRTa
The value of the key figure a is related to the aggregate value of all characteristics in
which the dynamic filter is ignored.
KHMAT2
KHMAT2
M1
Overall Result
Calendar year
Quantity
2001
5.000 PC
2002
6.000 PC
Result
11.000 PC
2001
7.000 PC
2002
8.000 PC
Result
15.000 PC
26.000 PC
KHMAT2
M1
M2
Quantity
Calendar year
2001
5.000 PC
2002
6.000 PC
Overall Result 11.000 PC
SUMCT 'Quantity'
11.000 PC
11.000 PC
11.000 PC
42
SUMCT 'Quantity'
11.000 PC
11.000 PC
26.000 PC
15.000 PC
15.000 PC
26.000 PC
26.000 PC
SUMGT 'Quantity'
11.000 PC
11.000 PC
11.000 PC
SUMGT 'Quantity'
26.000 PC
26.000 PC
26.000 PC
26.000 PC
26.000 PC
26.000 PC
26.000 PC
SUMRT 'Quantity'
26.000 PC
26.000 PC
26.000 PC
SUMRT 'Quantity'
26.000 PC
26.000 PC
26.000 PC
26.000 PC
26.000 PC
26.000 PC
26.000 PC
43
44