Time Duration between the dates Selected on filter widget

Hello,

I'd like to get the time duration/ difference in date range filter widget that we select as seconds since I need to use that difference in my SQL Query. In Grafana we had the timeFrom & timeTo macros which will give us the value that we select in the widget of the dashboard. I'm wondering if we have something similar in Metabase to get this value?

image

Any help is appreciated.
Thanks!!!

Hi @s.raman
You would have to either use two simple Date filters, or make an advanced CTE in a lookup table with all dates, so you can return the min/max from that, which you can then use later on.
There's a request for having more control over the variables:
https://github.com/metabase/metabase/issues/4509 - upvote by clicking :+1: on the first post