Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Summing unique users in BigQuery and Google Analytics
select
platform,
DATE_TRUNC(DATETIME(TIMESTAMP_MICROS(event_timestamp)), WEEK(SATURDAY)) as week_start,
count(distinct(user_pseudo_id)) as unique_users
FROM `<project-name>.analytics_<id>.events_*`
group by week_start, platform
order by week_start asc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment