How to build a control that filters across several data sources in Looker Studio?


This is an issue that many people face pretty early during their Google Looker Studio (previously known as Data Studio) journey (and the reason why you're here today).


Need help ? We offer Looker Studio Support for companies.

Looking for a connector ? Check Supermetrics.


Let's say that's you've got two data sources sharing a field which is not a date (in this case, the default Date Range Control does filter across several data sources, bad example!). Maybe one data source is a simple GA4 property, and the other is your Search Console connector (but really works with any data sources, any field, as long as they've got the same format). They both offer a Country field.

Here, I've got two tables, left are yesterday's sessions from GA4, and right, my impressions in Google Search, both split by Country:

Looker Studio filter 2 data sources

Now, what if I wanted to add a Control to be able to filter by Country?

Well, pretty straight-forward, I click Add a Control in the top ribbon, select Drop-down list, choose my Search Console connector as data source, choose Country as my Control Field, set it to United States, and this is what I get:

Looker Studio filter not working

My Search Console table gets updated, but not my GA4 one. Similarly, if I were to switch the data source to the GA4 one, left table would get updated, right table wouldn't. So what can we do here to ensure both tables get updated?


Add fields with the same field ID to filter across data sources

Now, this is where the magic happens. Edit the first data source (top ribbon, Resource, Manage added data sources, Edit). Then, Add a filter, and set it up as follow:

Looker Studio Filter Create Fields

Do exactly the same things on the second data source. At this stage, you should have two fields with the same field ID (filter_country here, in reality field name does not matter), so now if one gets filtered, the other gets filtered as well. Why? Because they share the same field ID. This is what you need to remember today. Same field ID, same field for Looker Studio, if you filter on one, you filter on the other as well.

You can give it a try by changing the Control Field in your Control, replacing country by filter_country and selecting Spain this time. Boom, it's somewhat working:

Looker Studio Filter Somewhat Working

Why am I stating it's only sometimes working? Because we are indeed filtering on Spain in both tables, but the list of countries being different between the 2 data sources, the drop-down list is not offering me the full list of options. It only offers the options available in the choosen data source.

As of today, apart from upfront data transformation, there are not much solution here. Try to use the data source that is offering most options here.

And that's it. We managed to filter on a field across data sources. We did it with 2, but if you get the point, you can do it on 3, 4 and more data sources, sky is the limit!

PROBLEM ALMOST SOLVED !


Previous article: How to add a dynamic title in Looker Studio?

Next article: How to add a link in a table using the HYPERLINK function in Looker Studio?

Looking for something else? All our articles can be found on our blog page