Hi @Jaeng
You are grouping by "date". You need to only group by your trunc.
Try replacing the variable with a hardcoded value until it works exactly like how you intended.
@Jaeng Replace {{date}} with 'week' and run the query on your database. If the query doesn't run there, then it would be impossible for Metabase to run it.
From the looks of it, you'll need to add the case-clause to the select-clause too.