SSRS - 集团表达彩民总计(SSRS - Grand Total of Group Expre

2019-09-24 00:18发布

我的群组总是减去最后一个表达式[Hours1]从所述第一值[Hours1]的基团的值[EquipmentName1]数据集“数据集1的。

我需要一个总计的组表达总计为每件设备的

我无法使用从数据集“数据集1”,因为第一[小时1]值减去上次[小时1]值相同的公式。

如果我有2件装备,说Equipment1和设备2:

Equipment1 last [Hours1] = 10000 and first [Hours1] = 9500
Equipment2 last [Hours1] = 10500 and first [Hours1] = 10000

如果我用减去最后的公式[Hours1]从所述第一值[Hours1]的数据集的值"dataset1"的公式将是10500 - 9500

不过,我想:

(10000 - 9500) + (10500 - 10000) = Grand Total

下面是吸引我的表的一部分,企图

|_[Hours1]_|  =  Fields!Hours1.Value    
(e.g. 9500)

|___Expr___|  =  Last(Fields!Hours1.Value) - First(Fields!Hours1.Value) 
(e.g. 10000 - 9500 = 500)

|__________|  =  I need to total the value of Expr for all pieces of equipment

Answer 1:

You need to use some custom code to achieve that.

Go to Report -> Report Properties -> Code and type

Dim grandTotal As Integer;
Function AccumulateTotal(value as Integer)
    grandTotal = grandTotal + value
    return value
End Function

Function GetTotal()
    return grandTotal
End Function

Then on the textboxes you need to call the accumulate function

=Code.AccumulateTotal(Last(Fields!Hours1.Value) - First(Fields!Hours1.Value))

And on the Grand Total textbox you call the get total function

=Code.GetTotal()


文章来源: SSRS - Grand Total of Group Expression Totals