View Full Version : Rolling YTD month by month report


ChiefBlue
11-27-2008, 01:07 AM
I have created a monthly report which totals transactions by group on a monthly basis, with a date range parameter for the last year (eg 01/12/2007 - 30/11/2008). However, when I run it for the next month and the date range changes to 01/01/08 - 31/12/2008, I want the transaction details and Running Totals to move along by a month, so @dec07 becomes @jan08, @jan08 becomes @feb08 etc. Can anyone oblige?:-

GH1 Vehicle Reg

Detail (@dec07) £100 (@jan08) £75 etc etc
Detail (@dec07) £200 (@jan08) £50
Detail (@dec07) £300 (@jan08) £75
etc

GF1 Running Totals (@dec07) £600 (@jan08) £200

namliam
11-27-2008, 01:14 AM
Well it all depends on what you actually want....
This function will retrieve the first day of this month
date() - day(date()) +1
i.e. 01-Nov-2008

You can then use the DataAdd function to add months and years to that
DateAdd("YYYY",1,date() - day(date()) +1)
1-Nov-2009

Now substract one to get the last day of october.
DateAdd("YYYY",1,date() - day(date()) +1) -1
31-Oct-2009

From this you should be able to do what you want....

Good luck!