Advanced Date Filtering

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?

Solved Solved
0 2 10.2K
1 ACCEPTED SOLUTION

Brent_Wiles
Participant II

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

View solution in original post

2 REPLIES 2

Brent_Wiles
Participant II

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

The correct syntax in 1 filter is "2 years ago to week"

Top Labels in this Space
Top Solution Authors