Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Average issue Expand / Collapse
Author
Message
Posted Wednesday, August 28, 2013 8:18 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, March 12, 2014 10:09 AM
Points: 189, Visits: 333
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
Post #1489252
Posted Wednesday, August 28, 2013 10:08 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Yesterday @ 3:36 PM
Points: 1,184, Visits: 1,218
Are they really zeros or are they Nulls?

Try adding a check ( IIF() ) to see if the value is Nothing, if so, explicitly make it zero.

Just a thought,
Rob
Post #1489309
Posted Wednesday, August 28, 2013 9:43 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, March 12, 2014 10:09 AM
Points: 189, Visits: 333
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
Post #1489506
Posted Tuesday, September 3, 2013 9:51 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, September 11, 2014 10:19 AM
Points: 294, Visits: 819
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)))
Post #1491016
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse