Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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 )
Yeah, the datefield is YYYYMM.
Ok, try what i posted.
vCurrentPeriod: =max(PERIOD)
Sum({<YEAR=, MONTH=, PERIOD={">=$(date(addmonths(date#('$(vCurrentPeriod)','YYYYMM'),-12),'YYYYMM')) and and <= $(vCurrentPeriod) "} >} SALES )
thanks for the reply but there seems to be an error in the code? should there be a double and, and extra " marks?
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 )