1
votes

I have a MySQL Data Set connected as a Data Source in Google Data Studio, and I'm creating custom fields to use in reports. From the respective Google support pages, I have seen that the NOT REGEXP_MATCH formula should work ( See here on last line ) but it doesn't seem to.

This code works:

CASE
  WHEN REGEXP_MATCH(receipt,"75") AND REGEXP_MATCH(gameid,"75") THEN "0.75"
END

This code doesn't work ("Creating field failed: try again later"). In addition, from the editor, I can see that when using NOT, the THEN color turns back to black, which indicates that the editor doesn't understand it correctly (as it should turn purple):

CASE
  WHEN REGEXP_MATCH(receipt,"75") AND NOT REGEXP_MATCH(gameid,"75") THEN "0.75"
END
1

1 Answers

1
votes

Recreated the formula using a Google Sheets Data Source and it works as expected. One thing to try is whether explicitly stating the ELSE clause resolves the issue:

Number Field

CASE
  WHEN REGEXP_MATCH(receipt, "75") AND NOT REGEXP_MATCH(gameid, "75") THEN 0.75
  ELSE 0
END

Text Field

CASE
  WHEN REGEXP_MATCH(receipt, "75") AND NOT REGEXP_MATCH(gameid, "75") THEN "0.75"
  ELSE "Other Value"
END

Link to Google Data Studio Report with the Data Source and Embedded Google Sheet