0
votes

I am learning how to build SSRS reports. I'd like to have the ability to enter in a date range. I have a working query, but I'm new to building SSRS reports. I have Visual Studio 2012 to build my report.

This is the SQL query that I'd like to turn into a report:

SELECT DISTINCT
USER, DeptStart, DeptName, DeptEnd, COUNT(Files) AS FileCount
FROM My_Table
WHERE TYPE='ImportantFile'
AND TRANSDate BETWEEN '2015-03-01' AND '2015-03-15'
GROUP BY USER, DeptStart, DeptName, DeptEnd

If I use @Startdate and @enddate in the text editor, will that present a box to the user to enter the date?

Any help would be greatly appreciated!!

2

2 Answers

1
votes

Change

AND TRANSDate BETWEEN '2015-03-01' AND '2015-03-15'

To

AND TRANSDate BETWEEN @StartDate AND @EndDate

Then add a "StartDate" and "EndDate" parameter to your report.

https://technet.microsoft.com/en-us/library/ms159266(v=sql.100).aspx

0
votes

you can build some custom code to create a calendar using c# and SSRS API, but as you are just starting, I recommend some cascading parameters, 6 exactly 2 years, 2 months, 2 days.

Check out this https://msdn.microsoft.com/en-us/library/dd255197.aspx