在2008年水晶报表中计算小计的占总计的百分比 [英] Calculating Sub-totals as a percentage of Grand-total in Crystal Reports 2008

查看:715
本文介绍了在2008年水晶报表中计算小计的占总计的百分比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这已经被网上的人多次提出,但我不能为我的生活找出为什么我的解决方案不工作。

I know this has been asked time and again by people all over the net, but I can't for the life of me figure out why my solution isn't working.

我有一堆组,在每个组的页脚中,我有一个运行总计作为该组的子总计。在页面的最底部,我有一个运行总计,将所有这些子总计加在一起,给出一个总计。这一切工作伟大。

I have a bunch of groups, and in each group's footer I have a running total which acts as a sub-total for that group. At the very bottom of the page, I have a running total which adds all these sub-totals together to give a grand-total. This all works great.

在每个子总计(组页脚)的右侧,我有一个公式字段,用于计算此子总计占总计的比例。 >
即,如果总和为4,子总数为1,则公式字段显示25%。

To the right of each sub-total (group footer), I have a formula field which calculates what proportion of the grand-total this sub-total represents.
i.e. if the Grand-total is 4, and the sub-total is 1, the formula field displays 25%.

问题是,对于每个组中,总计尚未完全计数(直到最后一组),因此百分比是根据不完整的总计计算的。

The problem is that for each group in the report, the Grand-total hasn't yet been fully counted (until the last group), and so the percentages are being calculated against incomplete Grand-totals.

为了解决这个问题,我尝试在百分比公式字段上使用 WhilePrintingRecords; 函数,以确保在第二次通过报告之前不计算子百分比,届时大计应全额计算。

To combat this, I've tried using the WhilePrintingRecords; function on my percentage formula fields to ensure that the sub-total percentages are not calculated until the 2nd pass of the report, by which time the Grand-total should be fully calculated.

WhilePrintingRecords;
If {@LoggedToday} > 0 Then
    {#LoggedToday}  / {#TotalLoggedToday} * 100
Else
    0


b $ b

这不工作!它从字面上没有什么影响: - (

It's not working though! It's literally had no impact what-so-ever :o(

有没有人知道我在哪里错了?

谢谢。

Does anyone have any idea where I'm going wrong here?
Thanks.

推荐答案

是的,您使用连续总计算总计。

Yes, you're using a running total to calculate a grand total.

而是建议为您的百分比创建一个Crystal公式,形式如下:

Instead, I suggest creating a Crystal formula for your percentage, in the form:

Sum({ })%Sum({ code> 数字字段 })

Sum ({ numeric field }, { grouping item }) % Sum ({ numeric field })

这篇关于在2008年水晶报表中计算小计的占总计的百分比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆