Date range filter

I am creating a dashboard and i want it to be interactive, so the users can choose whatever date they are looking for.
My question is grouped by so that I can show the final values for each group, and therefore I do not add the dates in that table.

Is there a way to filter through dates, without them being in my table?

Hi @Ninappp
Currently the date range filter is a Field Filter and requires a connection to the table.column of the referenced field.
Without seeing the query, it’s difficult to know what possible workarounds there could be.

Okay so my query is:
WHEN “locale” = ‘ca’ then ‘es’
WHEN “locale” = ‘en_us’ then ‘en’
else “locale”
END as “country”,
WHEN “sales_channel” = ‘n’ then ‘direct’
WHEN “sales_channel” = ‘x’ then ‘direct’
else “sales_channel”
END as “sales channel”,
COUNT (“ref”) AS “ref count”, SUM (“price_cents”/100/“exchange_rate”) AS “price in euros”
FROM “public”.“orders”
WHERE “client_sent_payment_at” >= timestamp with time zone ‘2019-01-02 00:00:00.000+01:00’
group by rollup (“country”, “sales channel”)
order by (“country”)

I need only this info so that in the dashboard I have all values by each country, and when I add the date to the table it summs it up for each date too, and I dont need that I need just the totals

@Ninappp I don’t understand - there’s not any filter variables in that query. And if you want to filter on client_sent_payment_at, then you can just use Date filter, since it’s just a single date.

It doesnt allow me to filter the date when I put it on the dashboard

Where can I use this Date filter? the query or the dashboard?

@Ninappp Have a look at the documentation. You need to create filters variables in the query, like client_sent_payment_at >= {{filter}}

Oh I thought that I already have that field filtered. What am I missing? {}?

@Ninappp Post your query like it looks in Metabase - with the filter variables

Does that need to be a separate question?

@Ninappp I don’t understand. Please read the documentation again. And change your WHERE clause to this, then you’ll see the filter side panel. And then you select Date as Filter Type:
WHERE client_sent_payment_at >= {{filter}}

Okay I did it thanks!! I was supposed to connect it in the dashboard as well!

1 Like