如何在 Crystal Reports for Visual Studio 中实现数据透视报表? [英] How do I achieve a pivot report in Crystal Reports for Visual Studio?
问题描述
除了带有小计的水平线之外,我在任何报告中都是排名菜鸟.我有一个数据集,其中包含汽车在停车场所花费的时间.我必须生成一个表格,显示每小时一列和每天一行,显示特定日期特定时间的条目数.
I am a rank noob at any reporting but horizontal lines with sub-totals. I have a dataset that comprises the times spent by cars in a carpark. I must produce a table showing a column for each hour and a row for each day, showing the number of entries at a particular time on a particular day.
我会在 RDLC 设计器中发现这更容易,它是柱状分组,但我什至在 Crystal 中找不到这样的东西.
I would find this easier in the RDLC designer, with it's columnar groupings, but I can't even find such a thing in Crystal.
帮助.
推荐答案
假设以下字段:{table.car_id}
和 {table.census_time}
- 选择插入 |交叉表...;将交叉表添加到报表标题部分
右键单击交叉表并选择交叉表专家":
Right click the cross-tab and chose 'cross tab expert':
- 将
{table.census_time]
添加到列字段列表中;按小时分组 - 将
{table.census_time}
添加到行字段列表中;按天分组 - 将
{table.car_id}
添加到汇总字段列表中;计数
- Add
{table.census_time]
to the column-field list; group by hour - Add
{table.census_time}
to the row-field list; group by day - Add
{table.car_id}
to the summary-field list; count
** 编辑 **
您无需创建特殊公式即可从日期/时间字段中提取小时;交叉表将为您做到这一点.
You don't need to create a special formula to extract the hour from the date/time field; the cross-tab will do that for you.
选择Cross-Tab"选项卡,添加 {table.census_time}
字段,然后单击Group Options..."按钮.
Select the 'Cross-Tab' tab, add the {table.census_time}
field, then click the 'Group Options...' button.
选择每小时".从选择列表中.
Choose 'for each hour.' from the picklist.
这篇关于如何在 Crystal Reports for Visual Studio 中实现数据透视报表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!