cancel
Showing results for 
Search instead for 
Did you mean: 

Aggrigation of Last n Periods copied in past and current bucket

ankpatel
Contributor
0 Kudos

Hello,

There is existing SAP note which shows how to do aggregation of last n periods in current month. I want to have similar calculation for the past buckets. Below is the sample calculation from SAP Note

IF(("PERIODID0" >= "$$PERIODID0CU$$" -6) AND "PERIODID0" < "$$PERIODID0CU$$", "SALESqty@MTHPROD", NULL)

Here "$$PERIODID0CU$$" is referring to current month. What I want to do is do similar calculation from Past bucket, let say start from last year in weekly bucket. So what should I use instead if CU to refer past bucket.

Note: This will be dynamic and rolling calculation starting from past to current bucket.

Regards

Ankur

Accepted Solutions (1)

Accepted Solutions (1)

Alecsandra
Product and Topic Expert
Product and Topic Expert

Hi Ankur,

Can you try $$PERIODI0CU$$ - 52? Given the PERIODID0 is define for weekly buckets.

  • PERIODID0: Weekly periods
  • PERIODID1: Yearly periods
  • PERIODID2: Quarterly periods
  • PERIODID3: Monthly periods

Best

Alecsandra

ankpatel
Contributor
0 Kudos

Hi Alecsandra

I have model my calculation as below

IF(("PERIODID0" >= "$$PERIODID0$$" - 53) AND "PERIODID0" < "$$PERIODID0CU$$" , "HROLL11A@WKPRODSALESREGSEAGRP", NULL)

I know this will be valid for current bucket, but will be valid for past bucket also. We have a requirement where we want to calculate value in past bucket and save it in past bucket only.

Regards

Ankur

Answers (0)