Consolidate source data in Google Data Studio

1. If you want the dimension to be available throughout the dataset, in the main menu, go to Resource > Manage added data sources > Edit > + Add a Field.

2. If you need the dimension only at the table or graph level, click + Create New Field at the end of the Fields picker, or, in the selected dimension area, click + Add dimension.

In this case, we recommend building a new dimension at a data-source level.

3. Use the function CASE and regular expressions to group all Facebook and (if needed) Instagram sources into one.

CASE WHEN REGEXP_MATCH(Source, '.facebook.') THEN 'facebook.com' WHEN REGEXP_MATCH(Source, '.instagram.') THEN 'facebook.com' ELSE Source END For Facebook, you can create a unique source name to group all variations tracked by Google Analytics as a custom dimension.

4. If you’re creating a visualization that displays only source data (not medium), you can separate Google data into organic and paid traffic:

CASE WHEN REGEXP_MATCH(Source, '.facebook.') THEN 'facebook' WHEN REGEXP_MATCH(Source, '.instagram.') THEN 'instagram' WHEN Source = 't.co' THEN 'twitter' WHEN Source = 'google' AND Medium = 'cpc' THEN 'google ads' WHEN Source = 'google' AND Medium = 'organic' THEN 'google organic' ELSE Source END

5. Enter your case function in the formula box and save.