Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

set default value of date paramter as getdate()-1 in SSRS report Expand / Collapse
Author
Message
Posted Thursday, April 12, 2012 4:54 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Monday, October 5, 2015 5:07 AM
Points: 50, Visits: 339
Hi,

What is the expression to set the default date of date parameter to getdate()-1. I want the SSRS report to choose the Startdate as previous date and end date as current date.

I set the default value of parameter as =Today(), which displays current date, how to set it to previous date? Any ideas what should be the expression?

Thanks
Post #1282249
Posted Thursday, April 12, 2012 7:15 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Friday, February 5, 2016 2:07 PM
Points: 15,016, Visits: 12,988
Try this:

=DateAdd("d",-1,Today())





How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at SQLKover.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1282350
Posted Thursday, April 12, 2012 7:22 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Monday, October 5, 2015 5:07 AM
Points: 50, Visits: 339
Thanks. It worked.
Post #1282352
Posted Friday, March 27, 2015 4:20 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, February 3, 2016 11:27 PM
Points: 111, Visits: 388
Many thanks
Post #1672050
Posted Friday, July 17, 2015 4:58 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, October 8, 2015 6:30 AM
Points: 8, Visits: 55
Very helpful! Thanks!
Post #1703722
Posted Thursday, February 4, 2016 11:40 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Thursday, February 4, 2016 1:17 PM
Points: 331, Visits: 1,753
For some reason the VB functions like "=Today()" would not work for the default value for a date parameter (it gave me the red angry line but would not say why it didn't like it).

I ended up making a dataset as follows and it worked fine.

select convert(date,convert(char(10),getdate(),101)) as Today
Post #1758540
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse