Saturday, November 29, 2014

Creating a Month dropdown list for a report with multiple datasets

Just add a parameter for month. use a dataset that returns individual moths of year and link it to parameter to populate the values. Then in query behind use a logic to do filtering based on previous month


it will look like this



DECLARE @Month int = 5 --example value

SELECT ...
FROM Table
WHERE datefield >= DATEADD(mm,DATEDIFF(yy,0,GETDATE())*12 +(@Month-2),0)
AND datefield < DATEADD(mm,DATEDIFF(yy,0,GETDATE())*12 +(@Month-1),0)



The value you will pass from SSRS to query from parameter




Please Mark This As Answer if it solved your issue

Please Mark This As Helpful if it helps to solve your issue

Visakh

----------------------------

My MSDN Page

My Personal Blog

My Facebook Page


No comments:

Post a Comment