Search code examples
reporting-servicesreportingservices-2005

Adding Date to text field in SSRS 2005


I have this code I am adding to a textbox, a cell in a grid to be exact.

=Format(DateAdd(DateInterval.Year, -1, Now()), "yyyy")

What I want to do is change the "Now()" portion to a parameter that I am asking from the user

=Format(DateAdd(DateInterval.Year, -1, Parameters!Year.Value, "yyyy")

However this is not working.

So my question is how do I get a year date from the user then subtract 1 year from that and display it in one of these text fields?

Thank you


Solution

  • Besides you have a missing bracket, try converting to date type the parameter value.

    =Format(DateAdd(DateInterval.Year, -1, DATESERIAL(CINT(Parameters!Year.Value),1,1)), "yyyy")
    

    Let me know if this helps.