Calculating the previous year

Hi All ,

On a report, when a user enters a start date e.g. 25/03/10 and an end date 30/06/10 i want to be able to return the previous year’s orders for them. e.g. (last year start date)25/03/09 and (last year end date) 30/06/09.

how do i go about finding the preivous year’s date?

I think this was answered on Mibuso, but look into how CALCDATE works in the Help menu.

Yes, you should use CALCDATE.

The following code snippet should do the job:

StartDate: Date
EndDate: Date
PrevYearStartDate: Date
PrevYearEndDate: Date

// The StartDate and EndDate are entered by the user.

PrevYearStartDate := CALCDATE(’<-1Y>’,StartDate);
PrevYearEndDate := CALCDATE(’<-1Y>’,EndDate);