null output on case statement with computation

Hi,

Kindly assist what can we do to stop generating null values on the output. what can we do to troubleshoot?

Thanks.

Select
cast(avg((case when c.subcategorydescription = 'delivery' then b.score end +
case when c.subcategorydescription = 'listening skill' then b.score end+
case when c.subcategorydescription = 'communication skill' then b.score end)/3)*@customerinteraction as decimal(10,2))as [Average Total Customer Interaction],
EdwardPeterAsked:
Who is Participating?
 
mcmonapCommented:
Hi

To trouble shoot try simplifying the case statement, see if any of the results are null if you just run the case statements seperately, you will then need to isolate the nulls either by omitting them with a where clause or by using ISNULL to replace the null with another value ie ISNULL(b.score, 0):

Select      case
            when c.subcategorydescription = 'delivery' then b.score
      end deliv,
      case
            when c.subcategorydescription = 'listening skill' then b.score
      end list_sk,
      case
            when c.subcategorydescription = 'communication skill' then b.score
      end com_sk
--the rest of your query goes here
0
 
NawalKishore1976Commented:
Use Isnull(select statement, 0)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.