?
Solved

DateAdd year in SSRS expression

Posted on 2013-02-06
6
Medium Priority
?
14,492 Views
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?
0
Comment
Question by:BobRosas
[X]
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
6 Comments
 
LVL 37

Expert Comment

by:ValentinoV
ID: 38861299
Try this:

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

Author Comment

by:BobRosas
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.
0
 
LVL 37

Accepted Solution

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

=DATEADD(DateInterval.Year, -1, Today())  & " to " & Today()
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

Author Comment

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

Expert Comment

by:ValentinoV
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...
0
 

Author Comment

by:BobRosas
ID: 38861381
Good to know!  Thank you so much!
0

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…
Introduction Earlier I wrote an article about the new lookup functions (http://www.experts-exchange.com/A_3433.html) that ship with SQL Server 2008 R2.  In this article I’m going to show you another new feature of SSRS 2008 R2, this time in the vis…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

762 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