Average issue

  • Hi,

    When calculating the average value, its ignoring the zero values.

    For ex: to calculate the average of 10,20,30,0,0 it is calculating as 60/3 instead of 60/5.

    Can anyone pls let me know what should be the issue in SSRS

    I have given it as

    CStr(CDec(Round(Avg(Fields!QUOTE_VAL.Value),2)))

    and tried with different conversions in CDec area.

    Thanks

    Naveen

  • Are they really zeros or are they Nulls?

    Try adding a check ( [font="Courier New"]IIF()[/font] ) to see if the value is Nothing, if so, explicitly make it zero.

    Just a thought,

    Rob

  • I have added iif in both stored procedures as isnull(varname,0)

    and also in rdl i used iif isnothing(varname,0,varname) but still no luck

    Thanks

    Naveen

  • Perhaps it's inconsistent type of the data it's operating on?

    Try changing it to:

    CStr(CDec(Round(Avg(Cdbl(Fields!QUOTE_VAL.Value)),2)))

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply