Bulk editing of filters

Hi guys! Is there a way, to create or edit filters? My goal is to create many similar reports (~200) with only one chart. Then we will embed these reports personally to the relevant pages. But the problem is that I need a unique filter for every chart/report. 

Is there a solution how to avoid the manual creation of every filter? 

I appreciate any help you can provide.

0 5 151
5 REPLIES 5

@mihajlovichs, there is an API endpoint to add dashboard filters however the trick is those dashboard filters created then need to be applied to the individual dashboard elements of the report. Since there are a few calls required for this I'd recommend taking a look at this post which outlines which calls those are and the sequence of events -> https://www.googlecloudcommunity.com/gc/Technical-Tips-Tricks/How-To-Create-a-Dashboard-Filter-Throu...

Thank you, will try this one

Luka, excuse me, but one more question. I've tried the link, but there are more links to API documentation and screenshots which don't work 😞 Is it a temporary problem?

For example links

https://docs.looker.com/reference/api-and-integration/api-reference/v3.1/dashboard#create_dashboard_...

or 

https://docs.looker.com/reference/api-and-integration/api-reference/v3.1/dashboard#get_all_dashboard... 

I'm not sure about the screenshots, but for the links all of the endpoints live here in our API Explorer documentation for version 4.0 of our API.

Hi there! You can use the Looker API to do this programmatically update filters on dashboards. You can follow these steps:

1. Use GET/dashboards/{dashboard_id}to get the metadata for the dashboard you want to recreate.

2. You can take a look at info returned in the filter dashboard_filters section. These are all the filters you have on the original dashboard, this is the part that you'll want to edit and use in step 4. 

3. Make a copy of your original dashboard with POST/dashboards/{dashboard_id}/copy

4. Use the Update Dashboard Filter endpoint PATCH/dashboard_filters/{dashboard_filter_id} to make updates to the original filters on the new dashboard. If you're changing the filter field completely, you may also need to use the to update the filter listeners on each dashboard tile using the Update DashboardElement endpoint PATCH/dashboard_elements/{dashboard_element_id}in the result_maker.filterables section.

If the filter field is consistent across some or all of these reports that you are embedding, you can reuse the same dashboard but pass a different filter value via the embed url. You might be able to accomplish what you're looking to do via Looker's signed Embedding functionality without creating many copies of the same dashboard. For example, if you want to show different values for 2 embed users for a report filtering on State, you can use this URL for User A:  mycompany.cloud.looker.com/embed/dashboards/1?State=California and this URL for User B: mycompany.cloud.looker.com/embed/dashboards/1?State=Texas. You'll want to use user attributes for these embed users to ensure that row level data access is restricted to the appropriate level.