Skip to content

Instantly share code, notes, and snippets.

@svpino
Created December 18, 2015 15:35
Show Gist options
  • Save svpino/60cbf56c9935e00fd170 to your computer and use it in GitHub Desktop.
Save svpino/60cbf56c9935e00fd170 to your computer and use it in GitHub Desktop.
How to determine last 5 business days in BigQuery
select date
from
(select date_add(current_date(), -1, "DAY") as date),
(select date_add(current_date(), -2, "DAY") as date),
(select date_add(current_date(), -3, "DAY") as date),
(select date_add(current_date(), -4, "DAY") as date),
(select date_add(current_date(), -5, "DAY") as date),
(select date_add(current_date(), -6, "DAY") as date),
(select date_add(current_date(), -7, "DAY") as date)
where dayofweek(date) >= 2 and dayofweek(date) <= 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment