
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Set Analysis Date Period
Hi,
I am trying to create a set analysis calculation which includes a date period. I want to see the last 12 date periods combined in one sum. The PERIOD field is just a combination of the YEAR & MONTH.
I created a variable (vCurrentPeriod) to house the Current PERIOD so that is a rolling calculation.
Sum({<YEAR=, MONTH=, PERIOD={‘>=$(=vCurrentPeriod -11))<=$(=vCurrentPeriod)’}>} SALES )
Can anyone see where I am going wrong?
Thanks in advance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
is period a date field formatted like YYYYMM ?
vCurrentPeriod: =max(PERIOD)
Sum({<YEAR=, MONTH=, PERIOD={">=$(date(addmonths(date#('$(vCurrentPeriod)','YYYYMM'),-12),'YYYYMM')) and and <= $(vCurrentPeriod) "} >} SALES )

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yeah, the datefield is YYYYMM.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, try what i posted.
vCurrentPeriod: =max(PERIOD)
Sum({<YEAR=, MONTH=, PERIOD={">=$(date(addmonths(date#('$(vCurrentPeriod)','YYYYMM'),-12),'YYYYMM')) and and <= $(vCurrentPeriod) "} >} SALES )

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks for the reply but there seems to be an error in the code? should there be a double and, and extra " marks?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
quotes are fine. i have an extract and, and a space. try this.
Sum({<YEAR=, MONTH=, PERIOD={">=$(date(addmonths(date#('$(vCurrentPeriod)','YYYYMM'),-12),'YYYYMM')) and <=$(vCurrentPeriod) "} >} SALES )
