November 16, 2011 at 4:53 am
Hi All,
I have Requirement in ssrs , i need to create a report with the StartDate and Endate as parameter and this parameters should be Default values , Like while generating the report, the StartDate and Endate shuold be "auto-fill" the parameters with previous week's dates, from Monday to Sunday.
E.g. Today, being 16th November, when attempted to generate the report today, the StartDate and Endate parameters will get set to 11/7/2011 and 11/13/2011 respectively
Can any body please help me to achieve this in SSRS 2008
Thanks & Regrads
Deepak
November 16, 2011 at 5:09 am
Before getting to a possible solution, I'll steart with the part you don't like. What defines a week? Well, clearly a week is seven days, but whether it is sunday-saturday or monday-sunday, that depends.
As for the solution, you may write a query returning two fields, one for last week's first day and the other one for last week's last day. This dataset can be used as default values for your two parameters. You can use datepart, more specifically dw, in combination with dateadd to calculate the start and end of the previous week.
November 16, 2011 at 5:13 am
you could also build an expression to dynamically generate the dates if you are clued up on the expression builders in SSRS
other wise like Ole says, build in a new dataset which does a query to get the dates you want and get the parametes to use that dataset as its default values.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply