SQL Variable to work with "Month And Year" dashboard filter

Ah, here's something that might look more relevant.

what happens if you run the second query?

I get a “column not found error” for payment.create_time

I’ve played around a bit more and it seems I can’t use the field filter in a HAVING clause unless I use that column explicitly in the SELECT. For instance, SELECT MIN(create_time) will not work - it has to be SELECT create_time

Huh.

I think we’re officially outside of my sphere of competence re: SQL details/quirks =)

Hi Sameer, what datatype do i need to use for this?

I’ve tried date and it won’t allow me to add it? (Running 25.2)

Hi,

I’m new to Metabase but I think that you should write as follows:
select
bla bla bla
where {{month_year}}=true

And set the {{month_year}} to field filter and select the timestamp of the table you want.

I hope I understood the problem correctly and it help

@Yakir_David No, that’s incorrect. Field Filters should not include anything, since Metabase generate that part of the query.
https://www.metabase.com/docs/latest/users-guide/13-sql-parameters.html#the-field-filter-variable-type
And this topic is 3 years old, so it would probably be best to create a new topic instead.