在Crystal Reports中将行数据转换为列 [英] Transposing Row Data as Columns in Crystal Reports
问题描述
我从存储过程中返回了以下数据
I have the following data returned from a stored procedure
Staff Category Amount
----- ------- ------
Bob Art 123
Bob Sport 777
Bob Music 342
Jeff Art 0
Jeff Sport 11
Jeff Music 27
即使金额为零,也将始终为所有职员返回所有类别
All Categories will always be returned for all Staff even is the Amount is zero
我想在Crystal Report上执行的操作输出如下:-
What I want to do on my Crystal Report is output this:-
Staff Art Sport Music
----- --- ----- -----
Bob 123 777 342
Jeff 0 11 27
我实际上想将类别行中的数据作为报表的标题或列转置。
I effectively want to Transpose the data in the Category rows as headers or columns in my report.
我不想使用交叉表,因为我还有其他需要添加的东西,这些东西不太适合交叉表
I do not want to use a Cross Tab as I have other things I need to add which will not fit nicely into a Cross Tab
任何想法如何在Crystal中做到这一点?我正在使用版本11
Any thoughts on how I can do this in Crystal? I'm using version 11
推荐答案
按人员将报告分组,并将人员,艺术,体育,音乐作为文本字段分组
Group the report by staff and place staff, Art, Sport, Music as text fields in Group header.
现在在详细信息部分将数据放置为
now in details section place data as
Staff, formula 1 (If Category='Art' then Amount), formula 2 (If Category='Sport' then Amount), formula 3 (If Category='Music' then Amount)
如果Staff只有一个值,则可以将Staff放在组页脚中,并将所有值加到组页脚中(不要删除公式1,2 ,3从详细信息开始)
If Staff has only one value then its ok else place Staff in Group footer and take sum of all values in group footer (Don't remove Formula 1,2,3 from details)
这篇关于在Crystal Reports中将行数据转换为列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!