计算,不包括空值

对于SSRS中的每个行组,我有以下计算:

=(count(Fields!RowNumber.Value)*sum(Fields!RowNumber.Value*Fields!Score.Value) - sum(Fields!RowNumber.Value)* sum(Fields!Score.Value))/(count(Fields!RowNumber.Value)*sum(Fields!RowNumber.Value*Fields!RowNumber.Value) - sum(Fields!RowNumber.Value)* sum(Fields!RowNumber.Value)) 

计算工作显示斜率结果。

问题是一些Fields!Score.Values在行组中是空的,所以它不应该包含在计算中。 RowNumber是一个字段,对该行组中的每个分数添加1。

我怎么能把这个计算考虑在内,以排除Fields!Score中的空值?计算中的值?

举个例子:

 How it seems to be working How it should work: 1 0 (converting it to 0) 1 (not take into account this row) 2 0 (converting it to 0) 2 (not take into account this row) 3 4 3 4 4 4 4 4 5 4 5 4 6 4 6 4 

您可以在下面看到,上面的expression式将空格转换为0,并以不正确的结果0.914286结束,因为当没有考虑这些空白条目时,正确的结果是0。 下面是一些其他的例子。

这是在Excel中使用SLOPEfunction(= SLOPE(F5:F10,E5:E10)),在SSRS中使用上述expression式重新创build。 Excel似乎足够聪明,可以忽略系列中的空白条目,我需要SSRSexpression式中的相同function。

在这里输入图像说明

你的表情应该像下面的那样

 =( SUM(Iif(Fields!num1.Value=0,0,1) ) * SUM(Fields!rownum.Value*Fields!num1.Value) - SUM(Iif(Fields!num1.Value=0,0,Fields!rownum.Value)) * SUM(Fields!num1.Value) ) / ( SUM(Iif(Fields!Score.Value=0,0,1) ) * SUM(Iif(Fields!Score.Value=0,0,Fields!RowNumber.Value*Fields!RowNumber.Value)) - SUM(Iif(Fields!Score.Value=0,0,Fields!RowNumber.Value)) * SUM(Iif(Fields!Score.Value=0,0,Fields!RowNumber.Value)) )