'How to filter related records in Data Studio from multiple data sources using a filter on a field only available in one of the data sources?
I have two data sources. Both data sources have a different schema but do share one ID field.
DS1
| ID | Name | Age | Country |
|---|---|---|---|
| 1 | a | 23 | US |
| 2 | b | 10 | CA |
| 3 | c | 20 | UK |
DS2
| DS1 ID | Make | Model |
|---|---|---|
| 1 | AAA | BBB |
| 1 | CCC | DDD |
| 1 | EEE | FFF |
| 3 | GGG | HHH |
The DS1 ID field from DS2 is from DS1.ID.
I will have both of these as a table in a Data Studio report. Then I will add a filter on DS1.Country. This will obviously filter the DS1 table.
I want it to also filter on DS2 based on the matching DS2.DS1 ID rows against ID from DS1.
So, for example, if someone selects UK in the DS1.Country filter then this is what the report would show:
DS1.Country Filter
[ ] US[ ] CA[x] UK
DS1
| ID | Name | Age | Country |
|---|---|---|---|
| 3 | c | 20 | UK |
DS2
| DS1 ID | Make | Model |
|---|---|---|
| 3 | GGG | HHH |
I know how to filter two different data sources against the same field as discussed here but that is not what I am trying to do.
** Update 1 **
- Link to sample Google Sheet data source for both
DS1andDS2: https://docs.google.com/spreadsheets/d/1Du_-J8RIdQh8tFB-BPVaRqdb-nJc6rs5_2YRiodOAhI/edit?usp=sharing - Link to sample Data Studio report with these sources and a filter on Country: https://datastudio.google.com/reporting/97d51ba3-21f5-4220-a444-f308d31283d0. The country filter only filters the top table. I want it to filter the bottom table based on the IDs visible in the top table.
Solution 1:[1]
One approach is to blend the respective ID fields in both data sources and then use a fixed-size list control to show the Country values; to filter the data to show all records for UK set the default selection to UK (or select as required):
Join

- Join Operator: Left outer
- Table 1 Join Condition:
ID (Table 1) - Table 2 Join Condition:
DS1 ID (Table 2)
Tables

Table 1: Dimensions
IDNameAgeCountrytemp
Table 2: Dimensions
DS1 IDMakeModel
Fixed-size list Control

- Control Field:
Country - Default Selection:
UK(leave blank to view all values by default) - Metric:
ID; Aggregation:AVG
Editable Google Data Studio Report (Embedded Google Sheets Data Source) and a GIF to elaborate:

Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nimantha |
