Date Parameter In a LookML View

I have a LookML that is powered by a big query view where the dataset that I am pulling from is partitioned on date.

Currently I have the view hardcoded to pull everything from 2017 onward, as shown below:

SELECT
  *
FROM
  project.dataset.mydataset
WHERE
  date >= '2017-01-01' 

The problem is that this is a 6.9 TB query and takes about 15 minutes to run in the Looker Explorer.

Is it possible to change the date partition I have in the view to a parameter depending on the date range that is selected in the explorer?

For example, say the current date is 8/6/2021: 

I want to pull the last 7 days in the explorer -

52c3741d-8152-4554-bb17-04caa3d366e8.png

I would like the SQL code in the lookml view to update to this:

SELECT
  *
FROM
  project.dataset.mydataset
WHERE date >= ‘2021-07-31’

This would minimize the size and time of the pull drastically.

0 4 2,139
4 REPLIES 4
Top Labels in this Space
Top Solution Authors