我使用以下表达式来计算百分比:
=Fields!Days.Value/Sum(Fields!Days.Value, "Date_month_name")
Days.Value显示为0,但在我的一些结果中,而不是在我的百分比列中读取0%,它实际上是在读取NaN(非数字)。
有没有人知道我需要的确切表达论坛,我应该把它粘贴在我当前的表达中,说“NaN在哪里显示,而是放一个'0'?”
(见图片)
答案 0 :(得分:14)
我对上述答案没有运气。这对我有用:
=IIF(Single.IsNAN(Fields!Days.Value/Sum(Fields!Days.Value, "Date_month_name")), 0, Fields!Days.Value/Sum(Fields!Days.Value, "Date_month_name"))
答案 1 :(得分:10)
怎么样
=IIF(Fields!Days.Value > 0,Fields!Days.Value/Sum(Fields!Days.Value, "Date_month_name"),0)
答案 2 :(得分:6)
我将此用于类似案例,
=REPLACE(Fields!Days.Value/Sum(Fields!Days.Value, "Date_month_name"),"NaN","0")
答案 3 :(得分:3)
这是另一种选择。它应该解决问题,并摆脱{
"id": 12,
"hey": "hey"
}
响应:
Infinite
答案 4 :(得分:2)
尝试
=IIf(Fields!Days.Value Is Nothing Or Sum(Fields!Days.Value, "Date_month_name") Is Nothing, 0, Fields!Days.Value / Sum(Fields!Days.Value, "Date_month_name"))
答案 5 :(得分:2)
这是最简单的&最好,我想,
=Switch(
Fields!Days.Value/Sum(Fields!Days.Value, "Date_month_name") = "NaN",Nothing,
Fields!Days.Value/Sum(Fields!Days.Value, "Date_month_name") = "Infinity",Nothing,
Fields!Days.Value/Sum(Fields!Days.Value, "Date_month_name") = "-Infinity",Nothing
)
您也可以放0而不是。
答案 6 :(得分:0)
我遇到了类似的问题,发现以下内容最容易做到。
=Iif(
Fields!Days.Value.Value <> 0 AND Sum(Fields!Days.Value, "Date_month_name") <> 0
, Fields!Days.Value.Value/Sum(Fields!Days.Value, "Date_month_name")
, 0
)
可能不是最好的解决方案,但有效。