简体   繁体   English

SSRS表达式导致错误

[英]SSRS expression causing error

I have the following expression in SSRS:- 我在SSRS中具有以下表达式:

=IIf(IsNothing(Fields!Hours.Value), 0, Sum(Fields!Hours.Value) / Sum(Fields!ReportingHours.Value))

The expression appears as #Error . 该表达式显示为#Error I removed the division part of the equation, leaving just this: 我删除了等式的除法部分,仅保留了以下内容:

=IIf(IsNothing(Fields!Hours.Value), 0, Sum(Fields!Hours.Value))

Then the correct numbers appear. 然后出现正确的数字。 If I perform an addition operation, the calculation also errors out. 如果执行加法运算,计算也会出错。 It seems that it does not like something about performing mathematical operations when using the Sum() function. 使用Sum()函数时,似乎不喜欢执行数学运算。 If I do simple division without the Sum, as in this expression: 如果我不使用Sum进行简单除法,则如下所示:

=IIf(IsNothing(Fields!Hours.Value), 0, Fields!Hours.Value / Fields!ReportingHours.Value)

Then numbers show up fine. 然后数字显示正常。 It is only when I have the Sum() function on the expression that causes an error. 只有当我在表达式上具有Sum()函数时,才会导致错误。 Any ideas as to how to fix this? 关于如何解决此问题的任何想法?

Try the following expression:- 尝试以下表达式:

=IIf(IsNothing(sum(Fields!Hours.Value)), 0, Sum(Fields!Hours.Value) / Sum(Fields!ReportingHours.Value)

EDIT 编辑

I have edited my previous post. 我已经编辑了我以前的帖子。

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

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