Zzema
Zzema

Reputation: 307

Datastudio non calculated fields create

I connect datastudio with BigQuery. I try to use user functions in BigQuery and past personal Query in datastudio, but user functions (CREATE TEMP FUNCTION) is not supported in datastudio. Then I try use new non calculated field with categories, but something wrong:

CASE WHEN REGEXP_MATCH(campaign, '*-Moskva-*','*-moskva-*') THEN 'Москва' ELSE 'other' END

Error: Invalid formula

Upvotes: 0

Views: 542

Answers (1)

Nimantha
Nimantha

Reputation: 6471

It could be achieved using either of the following CASE statements:

1) WHEN campaign Contains -Moskva- or -moskva- THEN Москва

CASE
  WHEN REGEXP_MATCH(campaign, ".*(-[Mm]oskva-).*") THEN "Москва"
  ELSE "other"
END

2) WHEN campaign Contains Moskva or moskva THEN Москва

CASE
  WHEN REGEXP_MATCH(campaign, ".*([Mm]oskva).*") THEN "Москва"
  ELSE "other"
END

Created a Google Data Studio Report and GIF to elaborate:

Upvotes: 1

Related Questions