Skip to content

Instantly share code, notes, and snippets.

@romain9292
Last active December 16, 2020 10:38
Show Gist options
  • Save romain9292/f291683c82390102d21917ae3c4ba471 to your computer and use it in GitHub Desktop.
Save romain9292/f291683c82390102d21917ae3c4ba471 to your computer and use it in GitHub Desktop.
[Growth rate using SQL in BigQuery - Part 1] Computing a month over month revenue growth rate #SQL #BigQuery
SELECT
DATE_TRUNC(PARSE_DATE('%Y%m%d',
date),MONTH) AS months,
ROUND(SUM(totals.totalTransactionRevenue)/10e+6,2) AS revenue,
FROM
`bigquery-public-data.google_analytics_sample.ga_sessions_20*`
GROUP BY
1
ORDER BY
1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment