简体   繁体   中英

SSRS Calendar Report

I am using SSRS in Visual Studio 2008 and need to create a report that displays names on a calendar based on the dates pulled from the database. I would like the calendar to display a month at a time My query pulls data that looks like the following:

Name         StartDate        EndDate         NumDays (Shows difference between Start and EndDate)
 Tim          1/1/2000         1/1/2000          1
 Bill         1/4/2000         1/6/2000          3
 Tim          1/10/2000        1/11/2000         2

For my report, I would need a Calendar that displays "Tim" on 1/1, 1/10, and 1/11 and display "Bill" on 1/4, 1/5, 1/6.

Any advice would be greatly appreciated. Thanks in advanced!

To do this effectively you will need a table of dates (either in your database or generate one in your SQL query). You can then left join from that table in your query which will ensure you have a row for each day. The table of dates should also identify which dates belong to the same week. (One way would be to use the DATEPART(WK,Datecolumn) function.)

Next create a tablix in your report which groups by day for the columns and by the week identifier for the rows. You'll probably need to pull in the last few days of the previous month in order to get it to align to a Sunday start date (or whatever the first day of your calendar row is).

Each cell in the tablix will now be a box on your calendar.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM