I'm trying to get data for the following conditions in bigquery.
1. Given_Day -> Calendar_Day = PARSE_DATE('%d/%m/%Y','14/10/2020')
2. last_year_same_day -> Calendar_Day = DATE_ADD(PARSE_DATE('%d/%m/%Y','14/10/2020'), INTERVAL -1 YEAR)
3. last_week_same_day -> Calendar_Day = PARSE_DATE('%d/%m/%Y','14/10/2020') - 7
Above query filter works when used individually, but fails when applied together as Calendar_Day
equates three conditions.
Tried Query:
select
Calendar_day,
Sales,
from `table`
where
Calendar_Day = DATE_ADD(PARSE_DATE('%d/%m/%Y','14/10/2020'), INTERVAL -1 YEAR) #last_year_same_day
and Calendar_Day = PARSE_DATE('%d/%m/%Y','14/10/2020') - 7 #last_week_same_day
and Calendar_Day = PARSE_DATE('%d/%m/%Y','14/10/2020') #today
Need Solution. Thanks in Advance!
where
(Calendar_Day = DATE_ADD(PARSE_DATE('%d/%m/%Y','14/10/2020'), INTERVAL -1 YEAR)) #last_year_same_day
OR (Calendar_Day = PARSE_DATE('%d/%m/%Y','14/10/2020') - 7) #last_week_same_day
OR (Calendar_Day = PARSE_DATE('%d/%m/%Y','14/10/2020')) #today