Last active
January 4, 2022 16:09
-
-
Save alexflint/f9f0dbd6ffffed5dd25cf16ea63bd748 to your computer and use it in GitHub Desktop.
Date range from Google Data Studio in Bigquery SQL
This file contains 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
SELECT | |
DATETIME(`begin`, 'US/Eastern') as `when`, | |
`host`, | |
`bytes`, | |
FROM | |
`mydataset.mytable` | |
WHERE | |
`begin` >= TIMESTAMP(PARSE_DATE('%Y%m%d', @DS_START_DATE), 'US/Eastern') | |
AND `begin` <= TIMESTAMP(DATE_ADD(PARSE_DATE('%Y%m%d', @DS_END_DATE), INTERVAL 1 DAY), 'US/Eastern') | |
# see https://support.google.com/datastudio/answer/10588439?p=bqparams&visit_id=637769059327596335-491020081&rd=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment