reporting-servicesstdev

How to exclude null values from column group to calculate StDev in SSRS?


I have to calculate StDev for my column groups. The problem is that it take in calculations null values. I use this:

=IIF(Fields!estNumerique.Value = 0, "n/a",Replace( Format( StDev( cDec( Replace( IIF(Fields!estNumerique.Value = 0, nothing, Fields!result.Value) ,",",".")))   ,"0.000") ,".",","))

And I get this result: result

I calculated Average wiht following method, but for StDev I cannnot find the solution:

=IIf(Fields!SomeField.Value = 0, 0, Fields!SomeOtherField.Value / IIf(Fields!SomeField.Value = 0, 1, Fields!SomeField.Value))

Thank you for your help!


Solution

  • The StDev function ignores NULL values. You are doing good by converting the 0's to NULL. The problem is that your CDec function is changing the NULL's back to 0. So just remove that.

    EDIT:

    Try this:

    =IIF(Fields!estNumerique.Value = 0, "n/a",Replace( Format( StDev( Replace( IIF(Fields!estNumerique.Value = 0, Nothing, CDec(Fields!result.Value)) ,",","."))   ,"0.000") ,".",","))