cancel
Showing results for 
Search instead for 
Did you mean: 

DP macros, calculating average values over a period of time

Former Member
0 Kudos

Hello

I have a key figure row, for the future i want this key figure to contain the average of a different key figure row over the last year.

How would you go about calculating the average value of a key figure row over a period of time and then assigning this value to another key figure?

I've tried variatons of AVG() and SUM() & SUM_CALC a but none of them seem to get me anywhere, i may not understand completely how rows & values work so any tips would be helpful.

Iin pseudo-logic: what i need to do is:

Calculate the average value of a key figure row over a given period (the last year)

Store this value somewhere, in regular programming it'd be a variable of some kind.

Assign this value to another key figure row 18 months into the future.

Regards

Simon Pedersen

Accepted Solutions (1)

Accepted Solutions (1)

srinivas_krishnamoorthy
Active Contributor
0 Kudos

Do not use SUM_CALC. You would need to try out with AVG() and SUM() - give argument discretely as each keyfigure bucket. So there will be 12 arguments.

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks for both of your suggestions, I'll pursue them and see if they any of them can solve the problem.

Points to both of you.

Strange that this should be so difficult

Former Member
0 Kudos

<H5>Hi Simon,

If you are a technical guy, you can create a BADI implementation for that macro and manipulate the matrix data like the way you want.

the procedure to implement a BADI is

1.SPRO --> SAP SCM - Implementation Guide --> Advanced Planning and Optimization --> Supply Chain Planning --> Demand Planning (DP) --> Business Add-Ins (BAdIs) --> MacroBuilder --> Additional Functions for Macros.

create a new implementation by copying the class for the BADI defenition '/SAPAPO/ADVX' and write your own code in the method '/SAPAPO/IF_EX_ADVX~USER_EXIT_MACRO '. There is a sample code and proceedure explaining how to handle the data in the internal tables C_T_TAB and C_T_TAB_OLD. the calculations can be made with help of I_T_LINES, I_T_COLS which are rows and columns tables.

find out the the row and columns of the grid to be read and do calculation and then put the result in the desired cell.

Please let me know if you need further assistance.

Regards,

Srini.

Award points for the helpful answers <H5>