I'm using Crystal Reports 2011 and have a crosstab that's displaying data by YEAR (Row) and MONTH (Column). I need to report 3 years worth of data at any given time but in the month of April is when I would need to drop an older year to pick up a newer year.
For example, currently since we are in February I am reporting 2010, 2011 and 2012. Once April 1st hits I will be reporting 2011, 2012, and 2013. So I will be dropping 2010 and picking up 2013 on the report. I am looking to automate this so the report will automatically change the years that it reports.
I've tried various record selection formulas but have not been able to nail down one that returns the desired years. The years are currently adjusted manually. On April 1st each year I manually adjust the report to drop 3 years prior and begin including current year data.
I'm looking for suggestions on how I can go about this. Appreciate the help!
Best Answer
I think I misstated the appropriate date ranges in my comments, but if I understand this correctly, we need formulas to do the following:
To do this, I came up with the followign formula fields:
Create a formula field called
DateRangeFrom
. It should contain:Create another formula called
DateRangeTo
. It should contain:You can then use these fields in your record selection formula, like this:
EDIT:
If you just want to search by the year, remove the
DateSerial
functions, and change your record selection formula to use>=
instead of>
, and you should be left with:Create a formula field called
DateRangeFrom
. It should contain:Create another formula called
DateRangeTo
. It should contain:You can then use these fields in your record selection formula, like this: