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'
end ))


  • MarkSnodgrass

    It looks as though your issue lies in the first case statement not having a condition. What do you want your SUM / COUNT to equal to in order to use `Live` ? That part appears to be missing. 

    Just before "then `Live`" you should have a greater than, or less than or equal to and a number. Hope that makes sense.

    **Check out my Domo Tips & Tricks Videos

    **Make sure to <3 any users posts that helped you.
    **Please mark as accepted the ones who solved your issue.
  • jaeW_at_Onyx

    ... i don't think you understood my last response to your last question.


    you have the same problem.  


    you're applying AVERAGE to an aggregated row.  SUM and a COUNT both of which will contain one row each.

    so your result will be the same as the value with AVG() removed.

    Jae Wilson
    Check out my 🎥 Domo Training YouTube Channel 👨‍💻

    **Say "Thanks" by clicking the ❤️ in the post that helped you.
    **Please mark the post that solves your problem by clicking on "Accept as Solution"