cancel
Showing results for 
Search instead for 
Did you mean: 

Weighted average on BEx Query Designer

mauriciobrandon
Explorer
0 Kudos

Experts,

I have a report requirement where I need to show some KPIs with weighted average. The layout should be like that:

CHAR_1CHAR_2CHAR_3CHAR_4KPI_AKPI_B
KF at cubeKF at cube
Center 1Lot 1Material 1“028”28100
Center 1Lot 1Material 1“029”29150
Center 1Lot 1Material 1ResultShould show weighted average of KPI_A by KPI_B from white lines = 28,5447250
Center 1Lot 1Material 2“045”4575
Center 1Lot 1Material 2ResultShould show weighted average of KPI_A by KPI_B from white lines = 4575
Center 1Lot 1Result Should show weighted average of KPI_A by KPI_B from orange lines = 34,3753325
Center 1Lot 2Material 1“090”90250
Center 1Lot 2Material 1ResultShould show weighted average of KPI_A by KPI_B = 90250
Center 1Lot 2Result Should show weighted average of KPI_A by KPI_B from orange lines = 90250
Center 1Result Should show weighted average of KPI_A by KPI_B from yellow lines = 73,4559575

I have tried the following: creation of KF that multiplies KPI_A and KPI_B at the cube and use of some calculated KFs at query using SUMCT to divide the lines by the subtotal to help calculate this KPI_A correctly, but the values are wrong:

CHAR_1CHAR_2CHAR_3CHAR_4KPI_AKPI_BKPI_CKPI_DKPI_E
KF at cubeKF at cubeA* B (calculated at cube)KPI_C / (SUMCT (KPI_A*KPI_B))KPI_A * KPI_D
Center 1Lot 1Material 1“028”2810028000,455312,7484
Center 1Lot 1Material 1“029”2915033500,544715,7963
Center 1Lot 1Material 1Result57, but should show weighted average of KPI_A by KPI_B from white lines = 28,544725061506150 / 9525 = 0,6457 57 * 0,6457 = 36,8049
Center 1Lot 1Material 2“045”45753375145
Center 1Lot 1Material 2Result45, but should show weighted average of KPI_A by KPI_B from white lines = 457533753375 / 9525 = 0,3543 45 * 0,3543 = 15,9435
Center 1Lot 1Result 102, but should show weighted average of KPI_A by KPI_B from orange lines = 34,375332595259525 / 32025 = 0,2974 102 * 0,2974 = 30,3348
Center 1Lot 2Material 1“090”9025022500190
Center 1Lot 2Material 1Result90, but should show weighted average of KPI_A by KPI_B = 902502250022500 / 22500 = 1,0000 90 * 1,0000 = 90
Center 1Lot 2Result 90, but should show weighted average of KPI_A by KPI_B from orange lines = 902502250022500 / 32025 = 0,7026 90 * 0,7026 = 63,2340
Center 1Result 192, but should show weighted average of KPI_A by KPI_B from yellow lines = 73,45595753202532025 / 32025 = 1,0000 192 * 1,0000 = 192

The issue is that the user should be able to add or take characteristics off the report and the report should dinamically calculate this averages and the individual values.

Is there a way to attend this issue the way it is? If not, what could be offered to satisfy the user need?

Regards,

Maurício.

Accepted Solutions (1)

Accepted Solutions (1)

cornelia_lezoch
Active Contributor
0 Kudos

hi Mauricio,

I would try to find a way with using exception aggregation.

create a calculated key figure (mostly it works better when this is a global one) that does the multiplocation of KPI_A * KPI_B.

Then put an exception aggrgeation to this using the most detailed char, probably char 4 or material. The exception aggregation type should be avereage.

if this still not give the correct results, you might need a sort of nested aggregation - meaning have a calculated key figure with exception aggregation for the first char, then put this into another CKF with exception aggregation for char 2 and so on.

regards

Cornelia

mauriciobrandon
Explorer
0 Kudos

Hi Cornelia,

I've already tried the exception aggregation approach. At the second table from my message, there are KPI_C, KPI_D and KPI_E, if you scroll right the message. KPI_C is configured to use exception aggregation at a created fake characteristic that concatenates all key characteristics.

I'm not sure if there is another thing to complement on this solution. I'm not even sure if this problem does have a solution at BEx.

Regards,

Maurício.

Answers (0)