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
 Development Tools
 Reporting Services Development
 Last week date range in report service parameter

Author  Topic 

flints
Starting Member

1 Post

Posted - 2012-02-28 : 04:39:25
I have some reports which need to run each week using subscription.
I need to set default values for parameters StartDate & EndDate for previous calendar week(Mon-sun)
Some ideas?

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-02-28 : 08:22:38
This expression would give you the date for last sunday (if you are running it Monday or later)
=DateAdd("d",(Fix(DateDiff("d","1/1/1900",Today())/7))*7-1,"1/1/1900")
And this would give you the Monday before that:
=DateAdd("d",(Fix(DateDiff("d","1/1/1900",Today())/7))*7-7,"1/1/1900")
Go to Top of Page
   

- Advertisement -