CASE WHEN CLASS = 'SU' and COUNT > 0 THEN (SELLP - BUYC)/SELLP ELSE ' ' END AS [Disc]
When using the above code I am getting an error as "Error converting data type varchar to numeric"
it works when I update the query
CASE WHEN CLASS = 'SU' and COUNT > 0 THEN (SELLP - BUYC)/SELLP ELSE NULL END AS [Disc]
A column, and therefore a case expression, can only have one datatype. ie A column cannot be both a number and a string.
Formatting is really a job for the front end so I would be inclined to leave the ELSE as NULL.
If you really want the blank you will either have to cast to a string or sql_variant.
CASE WHEN CLASS = 'SU' and COUNT > 0 THEN CAST((SELLP - BUYC)/SELLP AS varchar(20)) ELSE '' END
CASE WHEN CLASS = 'SU' and COUNT > 0 THEN CAST((SELLP - BUYC)/SELLP AS sql_variant) ELSE CAST('' AS sql_variant) END
ps I am surprised you got an error as I suspect the '' should just be cast to 0 (zero).