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 12»»

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: Wednesday, June 29, 2016 8:51 AM
Points: 52, Visits: 387
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: Yesterday @ 2:11 AM
Points: 15,149, Visits: 13,038
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: Wednesday, June 29, 2016 8:51 AM
Points: 52, Visits: 387
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: Yesterday @ 3:42 AM
Points: 111, Visits: 407
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: Monday, May 9, 2016 6:41 AM
Points: 8, Visits: 56
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: 2 days ago @ 4:14 PM
Points: 350, Visits: 1,854
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
Posted Thursday, March 10, 2016 7:02 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, June 14, 2016 10:28 AM
Points: 47, Visits: 79
so in SSRS what if I wanted the date to always be tomorrows date?
Post #1768246
Posted Thursday, March 10, 2016 11:16 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Yesterday @ 2:11 AM
Points: 15,149, Visits: 13,038
rcooper 78099 (3/10/2016)
so in SSRS what if I wanted the date to always be tomorrows date?


You should be able to come up with that yourself.

This is the calculation to find "yesterday":
=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 #1768358
Posted Thursday, March 10, 2016 12:15 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Tuesday, June 14, 2016 10:28 AM
Points: 47, Visits: 79
=DateAdd("d",-1,Today())

I am assuming it would be
=DateAdd("d",+1,Today())
or
=DateAdd("d",1,Today())

which have both not worked.
Post #1768393
Posted Thursday, March 10, 2016 12:44 PM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Yesterday @ 2:11 AM
Points: 15,149, Visits: 13,038
rcooper 78099 (3/10/2016)
=DateAdd("d",-1,Today())

I am assuming it would be
=DateAdd("d",+1,Today())
or
=DateAdd("d",1,Today())

which have both not worked.


In what sense?
Is an error returned?




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 #1768403
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse