cancel
Showing results for 
Search instead for 
Did you mean: 

L-code for averge

Former Member
0 Kudos

Hi,

I want to find out the average of 'x' months of one key figure,where 'x' value is given in another fey figure using L-code.Can anyone help me?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I want different X for each period.It should be in maintained per PRODLOCCUST.It should be in Excel.

Irmi_Kuntze
Advisor
Advisor
0 Kudos

ok...

1) LCode: You really need it for cumulative calculations such as for projected stock calculation without heuristic run (e.g. in control tower planning area SAP5 in KF HPROJINV which is used for SCCTPROJECTEDINVENTORY). If I post more here, my entry will likely be removed, sorry.

2) Excel: Do you know how to work with local EPM keyfigures?
There is the downside that you can only calculate with what you see in your template, so if you would like to see the average of the PAST 3 months, you would need to include those into the planing view or to have a keyfigure with display lag of e.g. one year (compare model config guide chapter "Example: Attribute Transformation" to grab previous data


If you wanted to see at one point at time for all periods the average of the last 3 months, than I suggest you provide a defined cell some place above the grid which you highlight in a different color to enter the "3" into it. Planner can change that and result will be visible immediately. Give that cell a "name" (menu-> Formulas-> name manager).

Than add a local member (tab "IBP" -> Advanced -> EOM Edit Report -> in the popup go to Local Member). Add a name and description, flag "enable", put in your formula using the name you proided for the "X"-value, mark e.g. "insert after" and than attach to member and click on the ... to define in which position the new line shall apply. Dont forget to click on actions-> "Add" before you confirm with "ok". Makle sure your formula in excel does not contain ; but only , instead. Elsewise it is more or less the same than making normal formulas in excel

Alternative have a backend KF in Excel that you display above or below your averaging KF and check on that in your formula, if you really want to see a different average per each month - which I honestly doubt 🙂

3) Backend-Workaround: well, if it must be really that flexible, you probably cannot work with aggregated level as you could if you had e.g. a quarterly average (search for the post on that, two possible solutions where given if I remember right).
And attrbute transformation will likely not help either. Would be more easy if you had one or few possible X-values restricted

Maybe someone else can find a workaround without LCode?

Yours

Irmi

Former Member
0 Kudos

Hi Irmhild

Using L-code i want to calculate average of 'x'months of KF1,where 'x' value is provided in KF2.

Eg.If x=3,3months of moving average of KF1.

It should be in the same planning area..

X value is editable and it can be changed.

If the user gives 4,it should display 4months of moving average of KF1 in excel.

Regards

Krithika

Irmi_Kuntze
Advisor
Advisor
0 Kudos

same planning area is anyhow mandatory, question was for planing level

so assuming you have the following picture:

                    Oct    Nov      Dec     Jan     Feb     March    

Shipped     100     101     102     103     104     105

X                    3     4          5          3          2          7

Average          ...     ...     ...          ...          ...          ...

Would you really want to have different X per each period? Do you really want to have that maintained per PRODLOCCUST or rather just per LOC or whatever? Maybe the planner dont want to enter X hundred times but only once?

I assume that a user anyhow would want to have the average calculation always done by the same value and by a time.depending X

You have to be more clear on the real detailed requirement to provide a solution

SAP is not supporting all LCode. You have to contact product management / development directly if you want to go for that and check for permission and support. If you never worked on LCode, you will not be able to do it all on your own without their help anyhow if you dont know the language as there is no proper syntax check help. I could not have done it without them.

So, either contact them. Or to be able to find another solution please make a mockup , think it through completely how it shall look like and describe all details.

And do you need that for Analytics dashboard as well or only on Excel planning view? In Excel, it is a piece of cake to solve the requirement...

Irmi

Irmi_Kuntze
Advisor
Advisor
0 Kudos

Can you provide your example a bit more detailed, please?

On which level e.g. MONTHPRODLOCCUST is the KF1 you want to average?

On which level do you want to maintain your KF2 in which you maintain the vaue "x"? Is thhat the same level? Or would you need that on e.g. MONTHLOC or...

Do you plan to change the value for "X" constantly or is that more or less fixed once it's set?

And how do you intend to display it in Excel?

I will not provide you with help for LCode as that is not supposed to be used.

But depending on your requirement you may be able to solve it differently

For example, there was already a post on how to make a quarterly average, for which alone there where minimum two possibilities posted at the time

Plus, if you just want flexible to see an average but dont need that in the grid , you can just mark those cells in excel and see the average on the bottom right corner anyhow

Or you build an EPM key figure if you just want to see one value and not a rolling value by adding a column in which you make the average depending on any other cell you provide somewere above your planning grid...

You see there may be more solutions to your problem than just LCode. WOuld be good if you provide a mockup-excel how it should look like

Yours

Irmi