2 Replies Latest reply on May 3, 2018 6:01 AM by Danielle Johns

    Tableau Prep, IF Functions - Values contained at different points within a sting, IF contains

    Danielle Johns

      Hi Tableau Community!!


      Possibly a really basic question, but I am new to the whole thing and struggling to even google the right thing to help myself.






      Basically I have a field of (string) values containing different acronyms.


      For example values are of the form:



      Example Field
      abcd ERT 123 HNU'
      HNU abcde 578
      ABC abc ERT


      I wish to conditionally categorize these rows based on common characters. The values in example field are completely inconsistent apart from these common characters.


      EXAMPLE - I will create a complimentary column using a calculated field called ERT and the values within that field will either be 'NOT ERT' or 'ERT' depending on the contents of Example Field.

      I also wish to make another field for HNU in the exact same way.


      So far I have used the following to attempt this:


      IF contains ("ERT", [Strategy])=true THEN 'ERT' ELSE 'NON ERT' END


      This has not worked...everything is classed as NON ERT. I feel like this is because it is searching for an exact match, whereas I'm after some sort of partial match or something..


      I hope this is enough information!


      Thanks so much for reading