Percentage Calculation

Hi -

I am trying to find the % of one column of items compared to another. Specifically, the percentage of "online appointments" (a filtered option of "all appointments") compared to "all orders submitted". I cannot figure out the formula.

Previously, when figuring out the % of online scheduled appointments compared to all scheduled appointments I used the below formula:


when sum( case when `appt_source` = 'ONLINE' then 1 end) 

/ sum(1) is NULL then 0 

ELSE sum( case when `appt_source` = 'ONLINE' then 1 end) 

/ sum(1)


However, online / offline appointments were a part of the same column of data. I'm not sure how to replicate this method with 2 columns. Thanks!