Dynamic date trunc error bigquery

So I need to create dynamic date aggregation (day, week, month) using date trunc as a text filter. But I always got an error

A valid date part name is required at [2:31]

My query would be kinda like this where {{aggregation}} is a text filter where the user is supposed to type day/week/month

SELECT date_trunc(order_date, {{aggregation}}) as period,
FROM table a

I believe this happened because text filter automatically add single quote to the typed string, but date_trunc format in big query does not need single quote for the date part, any idea how to solve this? Thank you

Hi @gurarako
Have a look in the comments here:
https://github.com/metabase/metabase/issues/6583 - upvote by clicking :+1: on the first post

Ah thanks a lot!!! I must have missed the last reply that’s using bigquery sintax