If you put the code “(CAST(dateadd(‘day’, CAST(0 AS long), now()) AS date)-birth_date)/365.25”, to calculate an age in a native SQL Question it works, but if I put the same code in custom field in custom question, it doesn’t work.
We would prefer to use the custom question over native sql, but the custom field doesn’t seem to accept everything. Is this normal or is it a defect ?
Because the Custom Expressions are not functions in your database, but Metabase functions.
So we have to use SQL native question. Thanks a lot for the answer.
@Tania There’s a request for handling date/time in Custom Expressions, which would allow what you are trying to do with SQL:
https://github.com/metabase/metabase/issues/11330 - upvote by clicking on the first post