Quantcast
Channel: SCN : All Content - SAP Planning and Consolidation, version for SAP NetWeaver
Viewing all articles
Browse latest Browse all 5457

Average Calculation for Multiple months selection in BPC 10

$
0
0


Hello Experts,

 

I have the below requirement to calculate average FTE accounts based on FTE accounts for Multiple months selection.

 

Example: we have the below values for Account "ABC" .

 

2014.012014.022014.032014.042014.052014.062014.072014.08
1020304050607080

 

The expected result for "ABC_AVG" acount like below .

 

For Jan =Jan/1

       Feb =(Jan+feb)/2

       March =(jan+feb+March)/3

       April =(Jan+Feb+march+April)/4

      May =(Jan+Feb+march+April+May)/5  etc.

 

 

 

2014.012014.022014.032014.042014.052014.062014.072014.082014.092014.10
10/1152050303540454545

 

I have written the below code to acheive the result and it wokring fine most of the cases ,however if any time period don't have value,then no calculation happening.This is wrong for my requirement.

 

Basically I'm new to script.So,please help/suggest how to acheive this result in all cases. If  anybody provide better code then it will be reallly help me.

 

Note: YTD and QTD functionality not working in my environment.

 

*FOR %STM% = %TIME_SET%

*XDIM_MEMBERSET ACCOUNT = ABC
*XDIM_MEMBERSET TIME = %STM%

*WHEN TIME.MONTHNUM
*IS 1
*REC(EXPRESSION = %VALUE%,ACCOUNT = ABC_AVG)

*IS 2
*REC(EXPRESSION = (%VALUE%+[TIME].[TMVL(-1,%STM%)] )/2,ACCOUNT = ABC_AVG)

*IS 3
*REC(EXPRESSION = (%VALUE%+[TIME].[TMVL(-1,%STM%)]+[TIME].[TMVL(-2,%STM%)])/3,ACCOUNT = ABC_AVG)

*IS 4
*REC(EXPRESSION = (%VALUE% +[TIME].[TMVL(-1,%STM%)]+[TIME].[TMVL(-2,%STM%)]+[TIME].[TMVL(-3,%STM%)])/4,ACCOUNT = ABC_AVG)

*IS 5
*REC(EXPRESSION = (%VALUE% +[TIME].[TMVL(-1,%STM%)]+[TIME].[TMVL(-2,%STM%)]+[TIME].[TMVL(-3,%STM%)]+[TIME].[TMVL(-4,%STM%)])/5,ACCOUNT = ABC_AVG)

*IS 6
*REC(EXPRESSION = (%VALUE% +[TIME].[TMVL(-1,%STM%)]+[TIME].[TMVL(-2,%STM%)]+[TIME].[TMVL(-3,%STM%)]+[TIME].[TMVL(-4,%STM%)]+[TIME].[TMVL(-5,%STM%)])/6,ACCOUNT = ABC_AVG)

*IS 7
*REC(EXPRESSION = (%VALUE% +[TIME].[TMVL(-1,%STM%)]+[TIME].[TMVL(-2,%STM%)]+[TIME].[TMVL(-3,%STM%)]+[TIME].[TMVL(-4,%STM%)]+[TIME].[TMVL(-5,%STM%)]+[TIME].[TMVL(-6,%STM%)])/7,ACCOUNT = ABC_AVG)


*ENDWHEN

*NEXT
*COMMIT

 

 

Thanks,

Pramod


Viewing all articles
Browse latest Browse all 5457

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>