Reputation: 227
I am pulling data from Google BigQuery to Tableau.
In Tableau, I want a date filter which ranges from (selected date - 15)days to (selected date). The date filter in Tableau will look like- 11/12/2019 12:00:00 AM to 11/26/2019 11:59:59 PM
.
In BigQuery table, the data type of date is TIMESTAMP.
I want to write a query that takes the selected date and computes date 15 days backward so that in tableau I can go 15 days behind by using the filter. How do I do that?
Right now what I have is-
cast(datetime_trunc (datetime(run_time), hour) as string) date_time
Upvotes: 0
Views: 2187
Reputation: 172974
Below for BigQuery Standard SQL
SELECT <column list>
FROM `project.dataset.table`
WHERE DATE(run_time) BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 15 DAY) AND CURRENT_DATE()
Upvotes: 2