Advanced Date Filtering

  • 17 June 2022
  • 1 reply

Hello y’all

I am currently trying to find my way around the advanced date filtering, and struggling to find a syntax that caters what I need.

So, for the look that I need to build, I need to filter the past 2 years (2021,2022) but in 2022 I would like it to stop until the latest complete week.

I tried this, but looker does not understand it.

2 years before 1 week ago


Any ideas?


Best answer by Brent Wiles 17 June 2022, 20:29

View original

This topic has been closed for comments

1 reply

Userlevel 1

Hello! After reviewing the docs, it looks like you’ll need to split that syntax into 2 filter statements. (e.g.- 2 years, before 1 week ago)
Unfortunately, to my knowledge, you can’t add 2 filters on a single field outside of a custom filter. (for an AND statement at least, you can do it for an OR statement) 

One of the better alternatives for you is to use a dimension_group of your date field that at least includes the “date” and “year” timeframes. This allows you to add the 2 matches (advanced) filters that you need.

On the date timeframe, “before 1 week ago”
On the year timeframe, “2 years”


I tested this and it works great! Hope it works for you as well