How to exclude a specific date range

I'm asking a question. I've got a bunch of transaction data. I want to filter the transactions in such a way where I can see all from a specific date range AND exclude some from a specific date range. I can't seem to figure out how to exclude a specific date range.

I don't know if this answer is what you are expecting for, but have you trying to do it in your SQL query ?

Something like this :

SELECT *
FROM my_data
[[ WHERE date_field BETWEEN {{date_min_wanted}} AND {{date_max_wanted}}
 AND date_field NOT BETWEEN {{date_min_excluded}} AND {{date_max_excluded}} ]]
1 Like

I was trying to avoid writing a SQL query, but it seems I may have to

Hey Amanda

You should be able to play around with the between expression to exclude dates.

From the Question editor, go to Filters and create a Custom Expression.

As soon as you start typing between, you’ll be given an example of the format Metabase is expecting. Pop a “NOT” before it and you should be on your way.

1 Like