-1

I have a list of page names such as below:

  • Homepage
  • Product 1
  • Accounts
  • Sign In
  • Product 2
  • Campaign
  • Product 3

I want to use a calculated field in Google Data Studio to aggregate all Product pages. How would I write the code so that it still includes the other pages without manually inputting each individually? This is the code I have:

CASE
  WHEN REGEXP_Contains ( Page Title,  'Product' ) THEN "Product Page"
  ELSE [LEAVE AS IS]
END

What code would I write to leave the page title as-is but still including it? I feel like it's either something so simple or impossible and that's why I've been unable to find any answers. Would really appreciate any help!

logi-kal
  • 7,107
  • 6
  • 31
  • 43
jacob
  • 1
  • Could you elaborate by providing a publicly editable Google Data Studio Report (additionally, a Google Sheet if it's the data set) of the scenario (using sample data that shows 1) Input values (~10 rows) 2) Expected output 3) An attempt at solving the issue)? It would help users visualise the issue and test out suggestions on a specific use case with objective right / wrong answers. Without a [Minimal Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) it would be difficult to pinpoint a suggestion and the issue, e.g. Data Set, Data Source, Report, Fields, Chart. – Nimantha Feb 16 '22 at 05:28

1 Answers1

0

I would guess just this:

CASE WHEN REGEXP_Contains ( Page Title , 'Product' ) THEN "Product Page" ELSE Page Title END
ysth
  • 96,171
  • 6
  • 121
  • 214