Crystal Reports 交叉表,包含总和、百分比和计算值
作为水晶新手,我无法弄清楚如何计算下面的第 3 行和第 4 行。
第 1 行和第 2 行是数据总和的简单百分比。
第 3 行是计算值(见下文)。
第 4 行是数据点的总和(不是第 1 行和第 2 行中的百分比)
有人可以给我一些关于如何生成显示的指示,如下所示。
我的数据:
2010/01/01 A 10 2010/01/01 B 20 2010/01/01 C 30 2010/02/01 A 40 2010/02/01 B 50 2010/02/01 C 60 2010/03/01 A 70 2010/03/01 B 80 2010/03/01 C 90
我要显示
2010/01/01 2010/02/01 2010/03/01 ========== ========== ========== [ B/(A + B + C) ] 20/60 50/150 80/240 <=== percentage of sum [ C/(A + B + C) ] 30/60 60/150 90/240 <=== percentage of sum [ 1 - A/(A + B + C) ] 1 - 10/60 1 - 40/150 1 - 70/240 <=== computed [ (A + B + C) ] 60 150 250 <=== sum
Being new to crystal, I am unable to figure out how to compute rows 3 and 4 below.
Rows 1 and 2 are simple percentages of the sum of the data.
Row 3 is a computed value (see below.)
Row 4 is a sum of the data points (NOT a percentage as in row 1 and row 2)
Can someone give me some pointers on how to generate the display as below.
My data:
2010/01/01 A 10 2010/01/01 B 20 2010/01/01 C 30 2010/02/01 A 40 2010/02/01 B 50 2010/02/01 C 60 2010/03/01 A 70 2010/03/01 B 80 2010/03/01 C 90
I want to display
2010/01/01 2010/02/01 2010/03/01 ========== ========== ========== [ B/(A + B + C) ] 20/60 50/150 80/240 <=== percentage of sum [ C/(A + B + C) ] 30/60 60/150 90/240 <=== percentage of sum [ 1 - A/(A + B + C) ] 1 - 10/60 1 - 40/150 1 - 70/240 <=== computed [ (A + B + C) ] 60 150 250 <=== sum
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您使用的是 SQL 数据源,我建议导出每个输出行的值(即 [B/(A + B + C)]、[C/(A + B + C)]、[1 - A /(A + B + C)] 和 [(A + B + C)]) SQL 查询中的每个日期,然后使用 Crystal 的交叉表功能将它们转换为所需的输出格式。
Crystal 的交叉表并不特别适合对不同的输出行进行不同的计算。
Assuming you are using a SQL data source, I suggest deriving each of the output rows' values (ie. [B/(A + B + C)], [C/(A + B + C)], [1 - A/(A + B + C)] and [(A + B + C)]) per date in the SQL query, then using Crystal's crosstab feature to pivot them into the output format desired.
Crystal's crosstabs aren't particularly suited to deriving different calculations on different rows of output.