2

我有一个 SSRS 报告,在数据库中有一个按名称列Total_running_hours。单个 Cycle_number 有多个记录,例如超过 1 行具有相同的Cycle_number 但不同Block_numbers,并且对于具有相同的所有行,字段中的值Total_running_hours将相同Cycle_number
例如。具有 4 个差异的 1 个循环编号block_numbers包含Total_running_hours所有 4 行的相同。

现在的问题是,如果我把这个字段放在组页脚中,那么它只会显示Total_running_hours一次正确的值,但我的最终要求是,

我需要在报告页脚中获取该字段的总和,这需要明智地显示总和组。无论单个有多少行,Cycle_number它都只需要一次并显示结果。

我尝试了不同的方式,比如

=sum(ReportItems!textbox204.Value) // name of text box in Group footer

错误:报表项表达式只能引用同一分组范围或包含分组范围内的其他报表项。

=sum(Fields!total_running_hours.Value,Group_name) 

错误:范围参数必须设置为字符串常量,该常量等于包含组的名称、包含数据区域的名称或数据集的名称。

任何人都可以帮助我获得明智的总和吗

先感谢您。

4

1 回答 1

0

I found solution for this Problem.

We cannot simply sum the Total_Running_hours value as this would give us duplicates and the incorrect answer. We cannot sum the reporting services group as it goes out of scope There is no SUM DISTINCT available in Reporting Services 2005 so we can't get the distinct value that way.

Since the query may not return a particular Cycle_Number Type we cannot use that as a filter.

The solution found was to add a column of the row number within a windowed set partitioned by the Cycle_Number like this

ROW_NUMBER() OVER (PARTITION BY Cycle_Number ORDER BY Cycle_Number ) AS 'RowNumber'

Then in the reports’ footer total column we put an expression that only takes the first row’s value to sum and converts all other rows to zero in that windowed set.

=SUM(IIF(Fields!RowNumber.Value=1,Fields!Total_Running_hours.Value,0))

After using this if u found any error in textbox like #Error

Then try this

=SUM(IIF(Fields!RowNumber.Value=1,CDbl(Fields!Total_Running_hours.Value),CDbl(0.0)))

于 2013-08-28T09:42:06.767 回答