rjn2
February 9, 2021, 1:03am
1
Hello!
I’m looking to add the daterange filter to my query manually, wondering what I am doing wrong?
select
date_trunc("week", CAST(o.PROCESSED_AT AS timestamp)) AS PROCESSED_AT,
count(distinct o.order_number) as orders
from orders o
where o.PROCESSED_AT = {{daterange}}
group by 1
order by 1 desc
Thanks!
rjn2
February 9, 2021, 1:04am
2
also wondering, is there a way to add a filter for aggregation? if i want to filter to daily, monthly etc?
Thanks!
Luiggi
February 9, 2021, 1:19am
3
Hi @rjn2 , check this page in the documentation https://www.metabase.com/learn/building-analytics/sql-templates/field-filters.html , you need to change the syntax. BTW: that query is easily achievable with the GUI builder
1 Like
flamber
February 9, 2021, 11:03am
4
@rjn2 It’s currently not possible to change grouping easily. Depending on which type of question you’re using, there’s issues and requests open for that - upvote by clicking on the first post of each issue:
https://github.com/metabase/metabase/issues/9875
https://github.com/metabase/metabase/issues/6583
1 Like
rjn2
February 9, 2021, 3:32pm
5
i simplified it for the example - but thanks for the link!