DateAdd year in SSRS expression

I have a field on my SSRS report with this as the expression...
= DATEADD ("y", -1, Today())  & " to " & Today()

It runs and displays 2/5/13 to 2/6/13

What I want is to subtract a year so I want 2/5/12 to 2/6/13.  It appears to be subtracting just one day.  Please tell me what I'm missing?
BobRosasAsked:
Who is Participating?
 
ValentinoVBI ConsultantCommented:
Hmm, okay, how about this:

=DATEADD(DateInterval.Year, -1, Today())  & " to " & Today()
0
 
ValentinoVBI ConsultantCommented:
Try this:

= DATEADD (YEAR, -1, Today())  & " to " & Today()
0
 
BobRosasAuthor Commented:
Thank you for you quick reply.  I tried your code above and the report won't even run.  I get the error that "interval is not valid".  I also tried "yy" and it runs but just has an error where the date should be.  I also tried Now() instead of Today() but the date doesn't change it just adds the time.
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
BobRosasAuthor Commented:
YES!  Thank you!  I would not  have gotten that!
0
 
ValentinoVBI ConsultantCommented:
Cool, glad I could help! I didn't have SSRS around to try it out so needed two attempts this time.  Come to think of it, I do indeed always use that DateInterval.  If you type it in the expression builder, once you enter the dot it should show a list of possibilities...
0
 
BobRosasAuthor Commented:
Good to know!  Thank you so much!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.