简体   繁体   English

SSRS日历报告

[英]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. 我在Visual Studio 2008中使用SSRS,需要创建一个报表,该报表基于从数据库中提取的日期在日历上显示名称。 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. 对于我的报告,我需要一个在1 / 1、1 / 10和1/11上显示“蒂姆”并在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). 为了有效地做到这一点,您将需要一个日期表(在数据库中或在SQL查询中生成一个日期)。 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.) (一种方法是使用DATEPART(WK,Datecolumn)函数。)

Next create a tablix in your report which groups by day for the columns and by the week identifier for the rows. 接下来,在报表中创建一个Tablix,按天将列分组,将行标识符按周分组。 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. 现在,tablix中的每个单元格将成为您日历上的一个框。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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