Search code examples
google-analyticscaselooker-studiogoogle-analytics-4

CASE WHEN NOT CONTAINS_TEXT/REGEXP_MATCH Skewing Data - Looker Studio & GA4


I'm having an issue in Looker Studio, I'm trying to replicate a custom channel grouping and found the data was heavily skewed compared to GA4, so I've stripped it down and found where I believe the issue is. However, I've replicated the custom grouping arguments from GA4 as exactly as possible.

Below is what I'm replicating: [GA4 Conditions [1]: https://i.sstatic.net/YkKnW.png

What I've tried so far:

WHEN (Session default channel group = "Paid Search" OR
     Session default channel group = "Cross-network")
        AND NOT REGEXP_MATCH(Campaign,"((?i).*youtube).*")
        THEN "Paid Ads"
        ELSE "other"

WHEN REGEXP_MATCH(Default channel group,'Paid Search') OR 
     REGEXP_MATCH(Default channel group,'Cross-network') AND NOT 
     CONTAINS_TEXT(Campaign,'youtube') OR NOT 
     CONTAINS_TEXT(Campaign,'YouTube') THEN 'Paid Ads'

WHEN (Session default channel group = "Paid Search" OR
     Session default channel group = "Cross-network")
        AND NOT REGEXP_MATCH(Campaign, ".*(?i)(\\byoutube\\b).*")
        THEN "Paid Ads"
        ELSE "other"

When I add the NOT statement, it heavily skews the data in Looker Studio and does not compare to the GA4 data even though the conditions are replicated.

I've searched around but I can't seem to find a reason behind this and I feel like I may be missing something obvious, so I wanted to ask if anyone had any ideas.


Solution

  • It's a simple mistake where I'm cross-checking 'Session default channel grouping' against 'Campaign' and not 'Session Campaign'.