开发者

SSRS chart to show totals by hour

I have the following data:

+--------------------------+---------------+
|        Date Time         | Number of Hit |
+--------------------------+---------------+
| 2011-10-03 13:01:00 + 10 |             2 |
| 2011-10-03 13:05:00 + 10 |             3 |
| 2011-10-03 14:01:00 + 10 |             4 |
| 2011-10-03 14:04:00 + 10 |   开发者_如何学运维          5 |
+--------------------------+---------------+

I would like to create a Chart using Reporting Services that shows:

13 - 5
14 - 9

Basically I would like to show the number of hits by hour. Could someone show me how to do it ?


Depends on what other requirements you have, but probably easiest to group by hour in you SQL query:

SELECT
   DATEADD(hour, DATEDIFF(hour, 0, myDateTimeColumn, 0)) AS TimeByHour,
   SUM(hitCount) as Hits
FROM
   WebRecordsTable
GROUP BY DATEADD(hour, DATEDIFF(hour, 0, myDateTimeColumn, 0))

Then create a chart in SSRS and drag the Hits field to the Values section.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜