Skip to content

Instantly share code, notes, and snippets.

@ToddKerpelman
Created May 16, 2019 20:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ToddKerpelman/9bd2c7672b661a0c530a8895ead95a4e to your computer and use it in GitHub Desktop.
Save ToddKerpelman/9bd2c7672b661a0c530a8895ead95a4e to your computer and use it in GitHub Desktop.
WITH analytics_data AS (
SELECT user_pseudo_id, event_timestamp, event_name,
-- This value is different
UNIX_MICROS(TIMESTAMP("2018-07-29 00:00:00", "-7:00")) AS start_day,
3600*1000*1000*24*7 AS one_week_micros
FROM `firebase-public-project.analytics_153293282.events_*`
-- These values have changed
WHERE _table_suffix BETWEEN '20180728' AND '20180827'
)
SELECT week_0_cohort / week_0_cohort AS week_0_pct,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment