title: Group by month Google Analytics / BigQuery
body: <p>I am pretty new to BigQuery and have a question about grouping the <code>Date</code> using Google Analytics data (StandardSQL). The data is currently on daily level, how can I aggregate this to Year/Month level?</p>
  
  <p>Desired outcome: Data on year/month level + selection of only the last 12 months.</p>
  
  <pre><code>#StandardSQL
  SELECT
  TIMESTAMP(PARSE_DATE('%Y%m%d',date)) as Date,
  SUM(totals.visits) AS Visits,
  totals.timeOnSite AS TimeOnSite,
  totals.newVisits AS NewVisit
  FROM
  `XXXX.ga_sessions_20*`
  WHERE
  _TABLE_SUFFIX &gt;= '180215'
  GROUP by
  Date,
  TimeOnSite,
  NewVisit
  </code></pre>
  
  <p>Thanks in advance!</p>