DATE_TRUNC timestamp to week in SQL Runner

Hello, I’m using SQL Runner for the first time and am attempting to roll up a series of dates into their respective report weeks. 
I’ve attempted using DATE_TRUNC(‘week’, column_name) but it won’t run in SQL Runner. I’ve tried looking up other work-arounds for Looker’s SQL Runner specifically and am at a loss. Any ideas? Thanks in advance!

0 4 2,706
4 REPLIES 4

Hiya!

In SQL Runner we need to use the syntax required by your database dialect, not really specific to Looker SQL Runner.

And the query you write there will run directly on the database.

So, when you say “it won’t run” - what’s the error returned? What would be the syntax for this function in your dialect? 

If your query can run smoothly on the DB server, then it should work fine in Looker. 
for DATE_TRUNC , some DBs have that like : DATE_TRUNC( column_name, ‘week’)  as weekID

also you have to GROUP BY this field (weekID)

can we use date_trunc() in Looker model.file ? when we create an explore 

Dawid
Participant V

What are you trying to achieve that you would like to use functions in your model file?

Top Labels in this Space
Top Solution Authors