How-to get the week beginning date from date in Google BigQuery

In Google BigQuery, you can use the DATE_TRUNC() function to get the beginning date of a week. To get the week beginning date for a given date, you can use the following query:

  
SELECT DATE_TRUNC(date_column, WEEK(SUNDAY)) AS week_beginning_date
FROM your_table
  
Here, replace date_column with the name of the column that contains the dates for which you want to find the week beginning dates, and replace your_table with the name of your table.

The WEEK(SUNDAY) argument specifies that the week starts on Sunday. If you want to use a different day as the start of the week, you can replace SUNDAY with MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, or SATURDAY.

This query will return a new column called week_beginning_date that contains the beginning date of the week for each date in the date_column.