Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Rolling Forecast script logic (Average of month's actual to be forecast for remaining month of current year)

Hello Experts,

I have one requirement wherein Actual of month pertaining to Current year to be averaged and is to be posted as a Forecast for remaining months

For Example:

1) Fiscal Period is from April 2014 to March 2015

2) In the below mentioned example current period is 2014.06, hence actual data would be available from 2014.01 to 2014.05. I need to average Actual data from 2014.01 to 2014.05 and post the values to the period 2014.06 to 2014.12.

3) I would be selecting Time period from Data manager package.

The issue i am facing is I am not able to average-out actuals in script logic through providing variable. I have marked the same in red,in below script logic.

Script Logic:

*SELECT(%CURRENTMONTH%,"[LEVEL]",TCMOL_TIME,"[ID]='%TCMOL_TIME_SET%'")

*SELECT(%CURRENTYEAR%,"[YEAR]",TCMOL_TIME,"[ID]='%TCMOL_TIME_SET%'")

*SELECT(%ACTUALMONTHS%,"[ID]",TCMOL_TIME,"[ID]<'%TCMOL_TIME_SET%' AND [YEAR]='%CURRENTYEAR%' AND [LEVEL]='%CURRENTMONTH%'")

*SELECT(%FORECASTMONTHS%,"[ID]",TCMOL_TIME,"[ID]>'%TCMOL_TIME_SET%' AND [YEAR]='%CURRENTYEAR%' AND [LEVEL]='%CURRENTMONTH%'")

*FOR %TT% = %FORECASTMONTHS%

*XDIM_MEMBERSET TCMOL_TIME = %ACTUALMONTHS%

*WHEN TCMOL_TIME

*IS*

*REC(EXPRESSION = %VALUE% / 6,TCMOL_TIME = %TT%)

*ENDWHEN

*NEXT

Regards

Bhagyesh Ravange

Tags:
Former Member
replied

Correct code:

*SELECT(%M%,"[MONTHNUM]",TCMOL_TIME,"[ID]=%TCMOL_TIME_SET%")

*SELECT(%Y%,"[YEAR]",TCMOL_TIME,"[ID]=%TCMOL_TIME_SET%")

*SELECT(%ACT%,"[ID]",TCMOL_TIME,"[YEAR]=%Y% AND [ID]<%TCMOL_TIME_SET% AND [CALC]=N")

// For %TCMOL_TIME_SET%=YYYY.01 %ACT% will be empty and no REC will be executed!

*SELECT(%FCS%,"[ID]",TCMOL_TIME,"[YEAR]=%Y% AND [ID]>=%TCMOL_TIME_SET% AND [CALC]=N")

*XDIM_MEMBERSET TCMOL_TIME=%ACT%

*FOR %F%=%FCS%

*WHEN TCMOL_TIME

*IS*

*REC(EXPRESSION=%VALUE%/(%M%-1),TCMOL_TIME=%F%)

*ENDWHEN

*NEXT

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question