'Objective:'Give the GrossProfit for the same period for the dates between StartDate and EndDate for the prior year.'Give the GrossProfit for the YTD period of the dates from Jan 01 of last year to the EndDate for the prior year.

'Purpose:'Compare Year-Over-Year Gross for the same period for the current and past year.'Compare YTD Gross for the same period for the current and past year.

'Questions to answer:

'What is the CurrentYear? The year of the StartDate=DatePart(DateInterval.Year,Parameters!StartDate.Value)

'What is LastYear? The CurrentYear -1=Fields!CurrentYear.Value-1

'What is the first day of the LastYear's month?=DateSerial(Fields!LastYear.Value,DatePart("m",Parameters!EndDate.Value),01)

'What is the last day of the LastYear's month?=DateAdd("d",-1,DateAdd("m",1,Fields!LYFirstDayOfMonth.Value))

'What is the StartDate for last year? Use LastYear and 01/01 for Jan 01=DateSerial(Fields!LastYear.Value,01,01)

'What is the EndDate for last year? '(it must be the same day as the EndDate only with last year's date; except for leap years in Feb.)'If the CurrentYear is a leap year and the EndDate is in February and the EndDate is the end of the current month then the EndDate for last year is 28.'If the CurrentYear is not a leap year and LastYear was a leap year and the EndDate is in February and the EndDate is the end of the current month then the EndDate for last year is 29.'If the CurrentYear is not a leap year and LastYear is not a leap year then use the regular calculated last day of the month for all months.

Update: I am getting the following error nowWarning 1 [rsRuntimeErrorInExpression] The Value expression for the field ‘LYTD_EndDate’ contains an error: Argument 'DateValue' cannot be converted to type 'Date'.