Compute Multiple Metrics

May 26, 2016
By Bounteous
SELECT
  CONCAT(trafficSource.source,"/",trafficSource.medium) AS sourceMedium,
  newSessions / sessions AS percentNewSessions,
  bounces / sessions AS bounceRate
FROM (
  SELECT
    trafficSource.source,
    trafficSource.medium,
    SUM(totals.visits) AS sessions,
    SUM(totals.newVisits) AS newSessions,
    SUM(totals.bounces) AS bounces,
  FROM
    [google.com:analytics-bigquery:LondonCycleHelmet.ga_sessions_20130910]
  GROUP BY
    trafficSource.source,
    trafficSource.medium)