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: 2 days ago @ 5:03 AM
Points: 52, Visits: 367
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: Today @ 1:15 AM
Points: 15,143, Visits: 13,030
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: 2 days ago @ 5:03 AM
Points: 52, Visits: 367
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: 2 days ago @ 12:58 AM
Points: 111, Visits: 394
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: Monday, April 25, 2016 8:16 AM
Points: 338, Visits: 1,820
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: Today @ 2:57 PM
Points: 35, Visits: 47
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: Today @ 1:15 AM
Points: 15,143, Visits: 13,030
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: Today @ 2:57 PM
Points: 35, Visits: 47
=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: Today @ 1:15 AM
Points: 15,143, Visits: 13,030
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