我正在SQL Server 2005报告服务中撰写报告,涉及可能等于零的货币值的划分。我把下面的代码来检查零分母:SSRS报告中除以零错误
=IIf(Sum(Fields!PreviousPremiumMTD.Value) = 0, "N/A", FormatPercent((Sum(Fields!PremiumMTD.Value)/Sum(Fields!PreviousPremiumMTD.Value))-1, 0))
但是,由于某种原因,我仍然得到#错误在我以下警告报告显示抛出:
[rsRuntimeErrorInExpression] The Value expression for the textbox ‘textbox62’ contains an error: Attempted to divide by zero.
任何援助非常感谢。
您是否检查过? http://www.bennadel.com/blog/984-Using-NULLIF-To-Prevent-Divide-By-Zero-Errors-In-SQL.htm – 2012-04-25 19:58:31
@ D3mon-1stVFW有趣的想法,但我没有看到一个SSRS表达式编辑器中的NULLIF函数。 – 2012-04-25 20:05:20