DATE_TRUNC timestamp to week in SQL Runner

  • 28 September 2021
  • 4 replies

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!

This topic has been closed for comments

4 replies

Userlevel 2


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 


Userlevel 7
Badge +1

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