I was recently asked during a Crystal Reports XI training session, "How do I calculate the week commencing date for the same date from the previous year?"
Using a formula the delegate wanted to be able to calculate the date for the
Monday of the equivalent week to the current week a year ago.
For example using the date Tuesday 13th September 2011, the formula should return the week commencing date as Monday 13th August 2010.
Solution:
This can be achieved using, various Date Time functions, to produce the following formula:
DateSerial(Year(CurrentDate) - 1, Month(CurrentDate), Day(CurrentDate) - (DayOfWeek(DateAdd('yyyy', -1, CurrentDate), CRTuesday)))
If you have any questions, leave us a comment below, or need any assistance, please do not hesitate to Contact Us
|