DateAdd year in SSRS expression

Posted on 2013-02-06
Last Modified: 2013-02-06
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?
Question by:BobRosas
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 37

Expert Comment

ID: 38861299
Try this:

= DATEADD (YEAR, -1, Today())  & " to " & Today()

Author Comment

ID: 38861318
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.
LVL 37

Accepted Solution

ValentinoV earned 250 total points
ID: 38861330
Hmm, okay, how about this:

=DATEADD(DateInterval.Year, -1, Today())  & " to " & Today()
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.


Author Comment

ID: 38861354
YES!  Thank you!  I would not  have gotten that!
LVL 37

Expert Comment

ID: 38861373
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...

Author Comment

ID: 38861381
Good to know!  Thank you so much!

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by Valentino Vranken. Introduction: The first step of creating a SQL Server Reporting Services (SSRS) report involves setting up a connection to the data source and programming a dataset to retrieve data from that data source.  The data…
Hi, I have heard from my friends that it’s not possible to create Label Printing report using SSRS. I am amazed after hearing this words not possible in SSRS. I googled lot and found that it is possible to some of people know about the Report Bui…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question