Override Look Filters in the URL

Looker will not be updating this content, nor guarantees that everything is up-to-date. 

We often want to use a saved look as a sort of template and then dynamically override specific filter values, such as when we embed Looker into another application.

This post shows you how to do this.

Overriding Filters

The following example shows a Look where the default value for Orders Created At is saved as on the day 2017-11-01.

  • We see this URL (replacing <instance_name.looker.com> with the URL to your company's instance):

    https://<instance_name.looker.com>/looks/:id:

    In this case, toggle=fil appears in the URL, because we have expanded the filters box to show the value.

    13b2b450-cb43-4a45-acf5-d2dfd346ab57.png
  • We can override the filter value by visiting a URL and changing it to this:

    https://<instance_name.looker.com>/looks/:id?f[orders.created_date]=7+days

    1d53c8e2-75bb-4365-8ac1-370fa7a1adab.png

    Looker automatically rewrites the URL into a unique query ID (qid) parameter representing this ad hoc query, just like on an Explore page.

  • This is the format of the query parameter:

    f[view.field_name]=filter_expression&f[view.other_field]=filter_expression&etc

Read more about filter expressions on the Looker Filter Expressions documentation page.

Other Query Parameters

You can also override other query parameters besides the filter values, such as sort or limit, or even the visualization options. To see the full list of parameters:

  1. Create a query in the Explore page.
  2. Using the gear menu in the top right corner, select Share.
     

    32781c30-7983-46d4-aa97-b7de1d3e1fda.png
  3. Copy the URL in the Expanded URL field and paste it into a text editor to see the entire URL with all parameters.
     
    89e0df54-09cd-4b75-a25b-135080be9bed.png

Embedding

This technique works with embedding, too:

  • Add /embed/ in front as usual, and it will work as above.
  • For SSO embed, make sure you add this to the embed_path component prior to signing the iframe URL.
Version history
Last update:
‎06-23-2022 11:01 AM
Updated by: