简体   繁体   English

列组中的总和报告项目(SSRS 2008)

[英]Sum report item in a column group (SSRS 2008)

I have the following payroll table in an SSRS 2008 (R2) report: 我在SSRS 2008(R2)报告中有以下工资表:

工资表

The dataset returns labor transactions consisting of the following fields: 数据集返回包含以下字段的人工交易:

STARTDATE
STARTTIME
FINISHDATE
FINISHTIME
REGULARHRS (difference between finish and start)
REFWO (such as "Travel", "Holiday", "Work", etc and is used to sort into the categories shown in the table above)
TIMEWORKED (0/1 flag that indicates whether or not it counts towards "Time Worked" category)

I have a column grouped on STARTDATE so that it displays each day of the week (our weeks go Mon through Sun). 我在STARTDATE有一个分组的列,以便显示一周中的每一天(我们的几周是从周一到周日)。 Everything down to "Unpaid Time Off" is a simple expression (usually just in the format Sum(IIF(something,A,B) ) in both the daily column and the weekly (Totals) column. In the "Interim Regular" box (for the day grouping), I have the following expression: 在每日列和每周列(总计)中,直到“无薪休假”的所有内容都是一个简单的表达式(通常为Sum(IIF(something,A,B)格式)。在“临时常规”框中,对于当天分组),我有以下表达式:

=IIF(Weekday(Fields!startdate.Value)=1 
     OR Weekday(Fields!startdate.Value)=7 
     OR ReportItems!Holiday.Value>0,
    0,
    ReportItems!TimeWorked.Value-ReportItems!Holiday.Value-ReportItems!Bereave.Value)

Basically what I'm doing is saying: If STARTDATE is a Saturday, Sunday, or Holiday, the regular hours would be 0 since it would fall into OT1.5 (overtime, time and a half), otherwise I calculate the regular hours worked by subtracting Holiday time and Bereavement time from the Time Worked (since both are included as part of Time Worked). 基本上,我的意思是:如果STARTDATE是星期六,星期日或节假日,则正常工作时间将为0,因为它将降至OT1.5(加班,时间和时间),否则我将计算正常工作时间通过从“工作时间”中减去“假期时间”和“丧亲时间”(因为这两者都包含在“工作时间”中)。 This part works great!! 这部分效果很好! But when I try to sum up the total for the week using =Sum(ReportItems!InterimRegularDaily.Value) it tells me that I can't use an aggregate on a report item and that aggregate functions can be used only on report items contained in page headers and footers. 但是,当我尝试使用=Sum(ReportItems!InterimRegularDaily.Value)一周的=Sum(ReportItems!InterimRegularDaily.Value)它告诉我不能在报表项上使用汇总,并且汇总函数只能用于包含在报表项中的报表。页眉和页脚。 I've done extensive googling to see if there is a solution, but everything seems to involve writing custom functions. 我已经进行了广泛的谷歌搜索,看是否有解决方案,但是一切似乎都涉及编写自定义函数。 I can't believe it would be THAT hard to simply sum up a group calculation in an outer group! 我简直不敢简单地总结一下外部小组中的小组计算就很难了!

Any and all help would be greatly appreciated!! 任何和所有帮助将不胜感激!

Thanks! 谢谢!

You can add the scope the your Sum() expression to reverence the the whole dataset or a group: 您可以将范围添加到Sum()表达式中,以尊重整个数据集或整个数据集:

'Returns the sum of the whole DataSet
=Sum(Fields!TestField.Value, "YourDataSetName")

'Returns the sum of a group
=Sum(Fields!TestField.Value, "YourGroupName")

You can also stack them: 您还可以堆叠它们:

=Sum(Sum(Fields!TestField.Value, "Level3GroupName"), "Level2GroupName")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM