Using average formula for a calculated column having sum and count
I am trying to get an average of a calculation having a sum and a count used in it. something looks wrong considering it is looking at the avg and then sum, can someone help me with this? or suggest an alternative if possible?
((CASE when SUM(`ext_sls_a`)/
COUNT((CASE when `listing_status`='APPROVED' AND `inventory`=0 then 'Live OOS items'
when `listing_status`='APPROVED' AND `inventory`>0 then 'Live Purchasable items'
else 'Pending, Rejected, Suspended' end)) then 'Live' else 'Not Live'