Selecting Date Parameters as Days
I have developed a report in SSRS Report Builder which is current run manually each week i would like to run a subscription for this however am because the dates change week to week im not too sure how i go about doing this. Basically my repot has 2 Parameter 1. Start Date (Saturday) 2. End Date (Friday) How would i write these as an expression to always take the previous weeks saturday and friday? EG Today is 18th July so the report would need to run 7th July- 13th July
July 18th, 2012 12:27pm

Hi GMach-10, Here's what you can try: 1. For Start Date: =DateAdd ( DateInterval.Weekday, (-1 * DatePart(DateInterval.Weekday, Now())) - 1, Now() ) 2. For End Date: =DateAdd ( DateInterval.Weekday, (-1 * DatePart(DateInterval.Weekday, Now())) - 7, Now() ) Let me know if this does not work for you. HTH. Cheers, IceQB Please mark correct answers :)
Free Windows Admin Tool Kit Click here and download it now
July 18th, 2012 12:53pm

Hi There Thanks for your posting. ICeQb expression is fine but only thing which I can think of it will give you the date as well as time. If you would like to avoid time part(which I think you will) then please use expression like this For End date =formatdatetime(DateAdd ( DateInterval.Weekday, (-1 * DatePart(DateInterval.Weekday, today())) - 1, today() ),dateformat.ShortDate) And for Start =formatdatetime(DateAdd ( DateInterval.Weekday, (-1 * DatePart(DateInterval.Weekday, today())) - 7, today() ),dateformat.ShortDate) For End date =formatdatetime(DateAdd ( DateInterval.Weekday, (-1 * DatePart(DateInterval.Weekday, today())) - 1, today() ),dateformat.ShortDate) And for Start =formatdatetime(DateAdd ( DateInterval.Weekday, (-1 * DatePart(DateInterval.Weekday, today())) - 7, today() ),dateformat.ShortDate) I hope this will help If you have any question please let me know. Many Thanks Syed Qazafi Anjum Please click "Mark as Answer" if this resolves your problem or "Vote as Helpful" if you find it helpful.
July 18th, 2012 5:11pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics