Want dynamic date in query

I just want to change dynamic date instead of now() function in this query. can you help me in that.

Basically, it needs to be something dynamic picked from the filter selected (we want use the date which we will select in our filter instead of now() function.)

Hi @varnika
What do you mean by dynamic? Like selecting a date in a filter, then read this:

I tried basic date filter using variable option.

select * from persons where is_scraped=true and archive=false and is_poi = true and MOD({{updated_at}}::date - timezone('Asia/Kolkata',created_at)::date, 14) = 0 and timezone('Asia/Kolkata',created_at)::date != {{updated_at}}::date

It's correctly working in SQL question (see screenshorts)

but when I connected this question in Dashboard, this filter not working. returning zero.
16%20PM 06%20PM 57%20PM

Please suggest, why it is not working here.

@varnika But that is clearly not the same question - one is a Table, the other is a Number visualization.

YES, Need to change in GUI question so that filter can be used. I think there is no difference what we used number visualization or table visualization. The thing is it is not working in Dashboard.

@varnika Metabase does not support filter pass-thru to SQL variables from a GUI question:
https://github.com/metabase/metabase/issues/6449 - upvote by clicking :+1: on the first post

You would have to either create the question in SQL, or do all the filtering in the GUI question.

1 Like

ok, now got it. If I use Filed filter then Is it possible to use in GUI Question? What is difference b/w the two (basic variable filter and field filter)?

@varnika No, you cannot use any SQL variables in GUI questions. They are never parsed.

You can use your SQL question directly on a dashboard.

Have a look here for the difference between SQL filters: