2

I created the following Calculated Field in Tableau:

REGEXP_EXTRACT(LOWER([Negative Review]), '(\w+)\s+(?=room)')

My aim is to extract the word before "room"

I believe Tableau allows me to extract other words, if my "word of interest" changes. As such, I created a Parameter (parameter name [interest]), consisting of "room, reception, staff". I changed the Calculated Field into this:

REGEXP_EXTRACT(LOWER([Negative Review]), '(\w+)\s+(?=([interest]))')

When I changed the "word of interest" from one word to another, the Calculated Field didn't change (unless the words before room|reception|staff are all the same).

Am I thinking whimsically?

CK

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
Chee Kong
  • 23
  • 3

1 Answers1

1

Use concatenation:

REGEXP_EXTRACT(LOWER([Negative Review]), '(\w+)\s+(?=(' + [interest] + '))')
Ryszard Czech
  • 18,032
  • 4
  • 24
  • 37