Can I use DashBoard-Filters on written SQL?

Hi,

I am playing around with MetaBase and Clickhouse.
In the clickhouse-DB I have some colums as arrays. I had great experience building dashboards via auto-generated statements, but when I write own SQL the dashboard-filters do not work.

Is there a trick to make the filter visible/choseable on own sqls, when I edit the dashborad-filters?

Best Regards

Alexander

Hi Alexander - I believe you are looking for the "parameters" feature of Metabase. In your custom SQL, you'll want to set up parameters in your "where" statement. And then from a dashboard, you can point your filters at those parameters. There's some documentation here: https://www.metabase.com/docs/latest/users-guide/13-sql-parameters.html. I've used this feature extensively to good effect. Hope this helps! -J.

@Justin1 Completely correct - here's an article: https://www.metabase.com/learn/building-analytics/dashboards/filters.html

Ahhhh ... Ok then ... I will read this article then ... GREAT and THX a lot :slight_smile:

Got it so far ... thank for your quick reaction :slight_smile:

image

But actually I am searching for a TimeRange-filter (standard of my DashBoard).
Does anybody now if this is possible too?

Like this ?

[[AND parcels.ShipmentCreationDate between {{ShipmentCreationDateFrom}} and {{ShipmentCreationDateTo}}]]

better

[[AND parcels.ShipmentCreationDate >= {{ShipmentCreationDateFrom}}]]
[[AND parcels.ShipmentCreationDate <= {{ShipmentCreationDateTo}}]]

Last one works and shows me the filters on the question itself - not on the dashboard!
There is already a dashboard-filter bind to some other questions ... here I still get
image

For single-date-filter it is fine :slight_smile:
image

@Speey When you use simple Date filter in the question, then you can only select Single Date in the dashboard.

If you use Field Filters, then you have a lot of other options, but then the variable should only be:
[[AND {{ShipmentCreationRange}}]] - and then select Field Filter in the sidebar.
Reference: https://www.metabase.com/learn/building-analytics/sql-templates/field-filters.html

There are limitations with both Field Filters and simple filters (Text, Number, Date), so not everything is possible with both of them - each have their own forces and use-cases.

I like MetaBase :slight_smile:
Solution is already there : image

1 Like