'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 **



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

4

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

Tables

5

Table 1: Dimensions

  • ID
  • Name
  • Age
  • Country
  • temp

Table 2: Dimensions

  • DS1 ID
  • Make
  • Model

Fixed-size list Control

6

  • 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:

10

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