title: Google Analytics in BigQuery: getting total events for a specific event action and total sessions from the same query
body: <p>I'm trying to get a table with 3 columns:</p>
  <ol>
  <li>date</li>
  <li>total events for a specific event action</li>
  <li>total sessions for the whole site
  This is what I have at the moment:</li>
  </ol>
  <pre><code>SELECT 
      CAST(format_date('%Y-%m-%d', parse_date(&quot;%Y%m%d&quot;, date)) AS DATE) as DATE,
      COUNT(CASE WHEN hits.eventinfo.eventaction = 'Add to Cart' THEN hits.eventinfo.eventaction END) AS AddtoCart,
      SUM(totals.visits) AS visits
  FROM `bigquery-public-data.google_analytics_sample.ga_sessions_*`,
  UNNEST(hits) as hits
  WHERE
      _table_suffix BETWEEN '20160801' AND '20160815'
  GROUP BY date
  ORDER BY date desc
  </code></pre>
  <p>The problem is the unnesting of hits seems to multiply my number of sessions, this is what I get without the unnesting:</p>
  <pre><code>SELECT 
      CAST(format_date('%Y-%m-%d', parse_date(&quot;%Y%m%d&quot;, date)) AS DATE) as DATE,
      SUM(totals.visits) AS visits
  FROM `bigquery-public-data.google_analytics_sample.ga_sessions_*`
  WHERE
      _table_suffix BETWEEN '20160801' AND '20160815'
  GROUP BY date
  ORDER BY date desc
  </code></pre>
  <p>How can I have the 2 in the same table?
  Thanks for your help!</p>