如何在ssrs报告结果集中避免此错误?

时间:2017-03-14 11:16:32

标签: reporting-services ssrs-2012

我在ssrs报告中划分两列值时收到此错误。

1.OccupiedUnitsAtEndOfDate = 0.00

2.UnitCapacityAtEndOfDate = 0.00

这些是我正在获得的价值。

但是如果我把这个表达式我在这个表达式的结果集中得到#Error。

=IIF(Sum(Fields!UnitCapacityAtEndOfDate.Value) = 0.00 OR 
Sum(Fields!OccupiedUnitsAtEndOfDate.Value) = 0.00, 0, 
Sum(Fields!OccupiedUnitsAtEndOfDate.Value) /Sum(Fields!UnitCapacityAtEndOfDate.Value))

任何人都可以告诉我我做错了什么。请帮帮我吗?

2 个答案:

答案 0 :(得分:0)

SSRS评估IIF表达式中的所有可能输出值,无论条件是真还是假。您的表达式需要如下所示:

=IIF(Sum(Fields!UnitCapacityAtEndOfDate.Value) = 0.00 
    OR Sum(Fields!OccupiedUnitsAtEndOfDate.Value) = 0.00, 0, 
    Sum(Fields!OccupiedUnitsAtEndOfDate.Value) / IIF(Sum(Fields!UnitCapacityAtEndOfDate.Value)=0.00,1,Sum(Fields!UnitCapacityAtEndOfDate.Value))

答案 1 :(得分:-1)

尝试为每个字段声明数据集名称。

=IIF(Sum(Fields!UnitCapacityAtEndOfDate.Value, "DatasetName") = 0.00,0,IIF(
Sum(Fields!OccupiedUnitsAtEndOfDate.Value, "DatasetName") = 0.00, 0, 
Sum(Fields!OccupiedUnitsAtEndOfDate.Value, "DatasetName") /Sum(Fields!UnitCapacityAtEndOfDate.Value,"DatasetName")))