Email open rate calculations in subqueries with postgres So I'm relatively new to PostgreSQL, but here we go: 

I have a pgsql database that is receiving HTTP Post Email Events from my Sendgrid email server, and am trying to make a dashboard that displays all pertinent information. The query returns everything how I wanted, except for a crazy impossible open rate. I'm not sure how I can best find the unique open rate by email send. 

Here is the query I have so far, which returns valid results for everything but open rate:

 SELECT
  MIN(timestamp) as "Date",
  "EmailEvents".send_name as "Send Name",
  cohort as "Cohort",
  product as "Product",
  COUNT(DISTINCT email) AS "Send Size",
  opencount.openRate AS "Open Rate"       
 FROM
  "EmailEvents",
  (SELECT
   send_name,
   (100*(SUM(CASE   
    WHEN email IS NOT NULL   
    AND event = 'open' THEN 1   
    ELSE 0         
    END) / SUM(DISTINCT CASE   
    WHEN email IS NOT NULL THEN 1   
    ELSE 0         
   END))) AS openRate                   
  FROM
   "EmailEvents"                  
  GROUP BY
   send_name) opencount                 
 WHERE
  "EmailEvents".send_name = opencount.send_name                      
  GROUP BY
  "EmailEvents".send_name,
  product,
  cohort,
  opencount.openRate      
 ORDER BY
  MIN(timestamp) DESC


Any help would be appreciated. Thanks!!
Answering my own question...but after playing around with it for awhile this seems to provide the correct answer:

SELECT
  MIN(timestamp) as "Date",
  "EmailEvents".send_name as "Send Name",
  cohort as "Cohort",
  product as "Product",
  COUNT(DISTINCT email) AS "Send Size",
  (100*openCount.distinctCount / COUNT(DISTINCT email))::numeric AS "Open Rate" 
FROM
  "EmailEvents",
  (SELECT
   DISTINCT send_name,
   COUNT(distinct email) as distinctCount 
   FROM
   "EmailEvents" 
WHERE
   event='open' 
GROUP BY
   send_name) openCount 
WHERE
   "EmailEvents".send_name = openCount.send_name 
   AND EXTRACT(month 
   from
   timestamp) = EXTRACT(month 
   from
   now()) 
GROUP BY
  "EmailEvents".send_name,
  product,
  cohort,
  openCount.distinctCount 
ORDER BY
  MIN(timestamp) DESC


Hope this helps someone else looking for a similar solution!