SSRS表达式 - 求和两个字段

时间:2016-11-11 07:40:35

标签: sql-server reporting-services

我需要总结两个领域,但我不能。

你能帮助我吗?

=iif(Fields!ABC.Value= "", Nothing, Sum(Fields!PA.Value)) 
=iif(Fields!XYZ.Value= "", Nothing, Sum(Fields!PA.Value))

它不起作用:

=iif(Fields!ABC.Value= "", Nothing, Sum(Fields!PA.Value)) +
       iif(Fields!XYZ.Value= "", Nothing, Sum(Fields!PA.Value)) 

2 个答案:

答案 0 :(得分:4)

总结一下,我认为你只想默认为0而不是Nothing

=iif(Fields!ABC.Value= "", 0, Sum(Fields!PA.Value)) +
   iif(Fields!XYZ.Value= "", 0, Sum(Fields!PA.Value)) 

答案 1 :(得分:0)

我认为他正在寻找的东西是这样的:

=Sum(IIF(Fields!ABC.Value = "", Nothing, Fields!PA.Value)
=Sum(IIF(Fields!XYZ.Value = "", Nothing, Fields!PA.Value)