将 NaN 更改为 0



这是我目前的表达式,在答案为零之前工作正常,然后在我的报告中显示 NaN。

=sum(IIF(Fields!RestrictedTo.value = "Not applicable" or Fields!RestrictedTo.value = "Limited to item" or Fields!RestrictedTo.value = "room of origin" , 1, 0),"ADF") / sum(fields!total.value,"ADF")

我尝试以各种方式使用"没什么",下面是一个例子,但无法让它工作,请寻求一些帮助。

=IIF(IsNothing(sum(Fields!RestrictedTo.value = "Not applicable" or Fields!RestrictedTo.value = "Limited to item" or Fields!RestrictedTo.value = "room of origin" , 1, 0),"ADF")) / sum(fields!total.value,"ADF") , 0, sum(Fields!RestrictedTo.value = "Not applicable" or Fields!RestrictedTo.value = "Limited to item" or Fields!RestrictedTo.value = "room of origin" , 1, 0),"ADF") / sum(fields!total.value,"ADF")

试试下面的表达式

= IIF(IsNothing(Fields!RestrictedTo.value) and IsNothing(sum(fields!total.value,"ADF")) ,
0,sum(IIF(Fields!RestrictedTo.value = "Not applicable" or Fields!RestrictedTo.value = "Limited to item" or Fields!RestrictedTo.value = "room of origin" , 1, 0),"ADF")/ sum(fields!total.value,"ADF")
)

转到报表属性,然后在"代码"选项卡中键入:

函数除法(分子为双精度,分母为双精度(

如果分母 = 0,则返回
0,
否则
返回分子/分母 结束如果 结束功能

然后在报告中输入以下表达式:

=Code.Divide(sum(IIF(Fields!限制为值 ="不适用"或字段!限制到.值 ="仅限于项目"或字段!RestrictedTo.value = "Room of origin" , 1, 0(,"ADF"(/sum(fields!total.value,"ADF"((

相关内容

  • 没有找到相关文章

最新更新