Last active
May 17, 2019 18:19
-
-
Save ToddKerpelman/6a898672f506519f17af9b023153a3e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH analytics_data AS ( | |
SELECT user_pseudo_id, event_timestamp, event_name, | |
UNIX_MICROS(TIMESTAMP("2018-08-01 00:00:00", "-7:00")) AS start_day, | |
3600*1000*1000*24*7 AS one_week_micros | |
FROM `firebase-public-project.analytics_153293282.events_*` | |
WHERE _table_suffix BETWEEN '20180731' AND '20180829' | |
AND user_pseudo_id IN ( | |
-- Anybody who received 20 initial extra steps | |
SELECT DISTINCT(user_pseudo_id) FROM | |
(SELECT user_pseudo_id, | |
(SELECT value.string_value FROM UNNEST(user_properties) WHERE key = "initial_extra_steps") AS initial_steps | |
FROM `firebase-public-project.analytics_153293282.events_*` | |
WHERE _table_suffix BETWEEN '20180731' AND '20180829' | |
) | |
WHERE initial_steps = "20" | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment