cancel
Showing results for 
Search instead for 
Did you mean: 

SAP IBP reference previous month value in current month calculation.

mark_j
Explorer

Hello,

I have a requirement from our business to create a new key figure (KF1 for example) that has two conditions.

1. If my current period PERIODID3=$$PERIODID3CU$$", then have KF1 = KF2+KF3+KF4+K5-KF6-KF7

2. Else if period > than current period, MAX(KF1(t-1),0) +KF4 +KF5 -KF6 -KF7

We are not concerned with past data for this purpose, only current month moving forward. The issue I keep having is trying to reference to the previous month; I continue to receive chain errors since the key figure input references the same key figure. I attempted to create a helper key figure ZHKF1 = IBP_PERIODSHIFT(KF1,1) but still get the same error. All key figures are at the same planning level. (i.e MTHPRODLOC).

Thank you for any input!

EDIT Updated Pseudo code:

1. If current period PERIODID3=$$PERIODID3CU$$", then have KF1 = KF2+KF3+KF4+K5-KF6-KF7

for the following months, PERIODID3 > $$PERIODID3CU$$, then have MAX(KF1(t-1),0) +KF4 +KF5 -KF6 -KF7

View Entire Topic
ayanbishnu1981
Active Contributor

Hello mark_j

Create few helper KF at the same monhtly planning level like below

HKF1@MTHPRODLOC = KF2+KF3+KF4+K5-KF6-KF7

HKF2@MTHPRODLOC= CAGGR("HKF1@MTHPRODLOC",''SUM'',''FORWARD'',''PASTCURRENT'')

HKF3@MTHPRODLOC= (MAX("HKF2@MTHPRODLOC")+KF4 +KF5 -KF6 -KF7)

Now create the actual KF1

KF1@MTHPRODLOC= IF("PERIODID3"="$$PERIODID3CU$$","HKF1@MTHPRODLOC",IF("PERIODID3">"$$PERIODID3CU$$","HKF3@MTHPRODLOC",NULL))

Let me know if this works