Dashboard level filter

Hi everyone,

I'm trying to add a dashboard-level date filter to SQL-based cards in Metabase.

My event_time column is stored as a Unix timestamp in milliseconds, and I'm converting it using:

to_timestamp(event_time / 1000.0)

I created date variables in my SQL query, but when I try to connect a dashboard Date filter, I get:

"A date variable in this card can only be connected to a time type with the single date option."

What's the recommended way to make dashboard date filters work with Unix timestamp columns in SQL questions?

Thanks!

Use a view or Model to create a new column with the converted value, then use a Field Filter against that column. Metabase will understand the underlying type is timestamp and allow date/time ranges to be used.

Be aware that you won’t have indexing on that column unless you take steps to enable it in ways appropriate for your database engine. For instance, some database systems allow indexing a GENERATED BY .. VIRTUAL column, while others you may have to store the value then index that value.