Monday, April 19, 2010

SQL server Reporting Report parameters

Displaying last working day as default in SSRS Date report parameter:
I was creating a report today with SQL server reporting service and I had a requirement to display previous working day as default selected value whenever report is generated. We work from Monday to Friday and say if user runs report on Monday then default selection should be last Friday.
To do this:
- Create a Report file (RDL)
- Go to the Layout page
- right click and Add Report parameters
- Add a parameter with Data type DateTime
- Select non-queried radio button and set formula as =IIF(Weekday(TODAY())<3,DATEADD("d",-1 * (Weekday(TODAY())+1),TODAY()),DATEADD("d",-1,TODAY()))
and your'e good to go!!