Field Filters with date ranges

Hello! I am currently trying to use custom field filters to do something like the following. I’d like the end user to be able to select the month and year they would like to see sales, and the output would be sales for that month and year and sales for the same month in the previous year. I’d like the field filter to only be selecting like March 2020 and then the previous to be based on this same filter.

What I’ve tried:
with sales_last_year as (
select day, sum(sales) from x
where day <= {{date}} - interval ‘1’ year and day >= {{date}} - interval ‘1’ year
group by 1

this obviously doesn’t work. is there a way to add in custom field filters to queries like this?