Skip to content

Instantly share code, notes, and snippets.

@ddikman
Created August 1, 2022 02:31
Show Gist options
  • Save ddikman/92ba111c101e6a53677bb5dca8fd3f40 to your computer and use it in GitHub Desktop.
Save ddikman/92ba111c101e6a53677bb5dca8fd3f40 to your computer and use it in GitHub Desktop.
Efficient filtering of tables in google analytics
SELECT
count(*)
FROM
`<your_project>.analytics_196169157.events_*`
WHERE
event_name = 'event_name'
AND _TABLE_SUFFIX >= format_date('%Y%m%d', CURRENT_DATE() - 30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment