Dynamic Timeframe
Standard dynamic timeframe solution described here: https://help.looker.com/hc/en-us/articles/360001288468-Dynamic-Timeframes-for-Dimension-Groups has its drawbacks. Because the resulting dimension is string
, it means it won't get an automatic formatting from Looker, i.e. January
instead of 2022-01-01
However, there is a way that allows us to use dynamic timeframe and granularity, and also adds missing features:
You can filter using
timeframe
field rather than the field you're joining toDimension is returned as
date
, which means its recognised as time seriesApplication of the code can be simplified so that you don't need to copy it everywhere
Steps
High-level steps are as follows:
Expose your calendar table as view
calendar.view.lkml
Create a refinement of calendar view called
parameters.view.lkml
Join the calendar to your view
Change view_label of the calendar join to your main view's name
Enjoy
Things to remember:
In order to be able to use Timeframe with other values like Day of Week or Week of Year, the code would have to be altered.
Last updated