Search code examples
reporting-servicesdateadd

SSRS DateAdd (Previous YR End,


Hoping someone can help;

Im struggling a bit with the dateadd function on ssrs.

If for example I set my param. date as 30/4/16. And from that date I want to find: 1) previous yeard end (31-12-15) 2) previous 2 yr ends (31-12-14)

How do I go about it? I keep running into errors.

Thanks in advance,


Solution

  • You can get the last day of the previous year like this:

    =DateSerial(YEAR(Parameters!ReportParameter.Value) - 1, 12, 31)
    

    So you are building a date by providing the year, month and day to use. You are just subtracting 1 year from the year of the parameter value. Similarly, subtract 2 for 2 years ago.