I have a query on BQ that I run on a weekly basis, but not always on the same day of the week (sometimes on Monday, sometimes on Tuesday etc.)
Every week, I need to query data of the last two calendar weeks: e.g. assuming that we are now in CW 27 (isoweek, where Monday is the first day), I would like to have data from Monday of CW 25 to Sunday of CW 26.
FROM (TABLE_DATE_RANGE([xxx.ga_sessions_], DATE_ADD(CURRENT_TIMESTAMP(), -14, 'DAY'), DATE_ADD(CURRENT_TIMESTAMP(), -1, 'DAY'))) could work if I ran my query every week on Monday, but the limit is that I run it on different weekdays.
Does anyone have any idea? Any input is very much appreciated.
Thanks in advance!