Sunday, April 27, 2014

Find AVG : Exclude values which are 0 while finding AVG

Simple answer without seeing the whole query:



CAST(AVG(NULLIF ( ISNULL([1],0) + ISNULL([2],0) + ISNULL([3],0),0)) as DECIMAL(18,2))/3



NULLIF function will convert 0 to NULL and therefore it will be excluded from AVG.




For every expert, there is an equal and opposite expert. - Becker's Law





My blog




My TechNet articles


No comments:

Post a Comment