Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 SSRS Parameter Help

Author  Topic 

tooba
Posting Yak Master

224 Posts

Posted - 2012-07-31 : 00:15:15
Hi,

I have two Date Parameter (Start Date) & (End Date). I want to give a Default Value on (Start Date) & (End Date) (One Month Old Date) i.e (6/30/2012). If user want to use other date they can put and Can i Create Calender Window so user can easily select date.

Any Advise?



Thank You.

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-07-31 : 08:02:22
This expression will give you one month ago today:
dateadd("m",-1,Today())
Go to Top of Page

tooba
Posting Yak Master

224 Posts

Posted - 2012-08-01 : 20:21:46
I want something like this. I have two parameter Start Date and End Date. I want to use a default value Previous month. i.e If i try to run this report today default date
should be Start Date = 7/1/2012 and End Date = 7/31/2012 and if i run this report next month mean in September default date should be
Start Date = 8/1/2012 and End Date 8/31/2012.
Thanks for Help.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-01 : 21:55:07
startdate
=DateAdd(DateInterval.Month,DateDiff(DateInterval.Month,#01/01/1900#,Now()),#01/01/1900#)


EndDate
=DateAdd(DateInterval.Month,DateDiff(DateInterval.Month,#01/01/1900#,Now())+1,#01/01/1900#)

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

tooba
Posting Yak Master

224 Posts

Posted - 2012-08-01 : 22:14:06
Viskh16 Thank you for your reply. I tried your expression and now i am getting value START DATE = 8/1/2012 and END DATE = 9/1/2012. I really appreciate if i can get START DATE = 7/1/2012 and END DATE = 7/31/2012. If i run same report tomorrow i can get same default value START DATE = 7/1/2012 AND END DATE = 7/31/2012. Thanks for your help....
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-01 : 23:04:26
startdate
=DateAdd(DateInterval.Month,DateDiff(DateInterval.Month,#01/01/1900#,Now())-1,#01/01/1900#)


EndDate
=DateAdd(DateInterval.Day,-1,DateAdd(DateInterval.Month,DateDiff(DateInterval.Month,#01/01/1900#,Now()),#01/01/1900#))


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

tooba
Posting Yak Master

224 Posts

Posted - 2012-08-02 : 00:22:25
Awesome... Thank you for your help VISAKH16.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-08-02 : 10:13:24
welcome

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -