Reputation: 21
I've got an SSRS Report with a date parameter. In addition to this being an on-demand report, I also need to schedule it to run on the 1st of the month with the data parameter being the last day of the previous month. When I'm scheduling the report, there's a spot to enter a parameter value, but I don't know how to tell it to use yesterday's date.
Upvotes: 2
Views: 3176
Reputation: 97
There are two ways to achieve this
Create a Dataset and your query is as follows:
dateadd(second, -1, dateadd(month, datediff(month, 0, getdate()), 0)) as EndDate
Then in the Report Parameter Properties dialog:
Go to Default Values;
Select Get values from a query;
OR
You could use an Expression in the Report Parameter Properties Dialog:
Add the following expression:
DateAdd("D",-1,DateAdd("D",-(Day(Now)-1),Now))
Upvotes: 3