I'd like to graph the percent of whole using a beast mode

I am graphing Consultation data and one field I have access to is "excuse". I'd like to graph the percent of consultations where the excuse is "no show". I thought the following would work:

count(`id`) / sum(case when excuse = "no show" then 1 else 0 end)

But the results don't make sense. It's telling me that 35/443 = 12.66% and that 46/355 = 7.72%. I've obviously done something wrong in my case statement, I'm just not sure what it is.

Answers

  • Oh boy. I just realized I should have written:

    sum(case when excuse = "no show" then 1 else 0 end)/count(`id`)