2 Replies Latest reply on Dec 1, 2018 6:39 PM by Ritesh Bisht

    Counting occurrences of a substring

    Mark Robinson

      While this is rather easy to accomplish in Excel, I'm struggling to do so in Tableau.  All I need to do is count the occurrences of each of the characters in the list below, whether they stand alone or are included with another character. I've successfully counted all my A's using CONTAINS, but then the 'B' and 'D' are ignored since they're coupled with the 'A' and that condition has already been met.


      IF CONTAINS([Codes],"A") THEN "Alpha"
      ELSEIF CONTAINS([Codes],"B") THEN "Bravo"
      ELSEIF CONTAINS([Codes],"C") THEN "Charlie"
      ELSEIF CONTAINS([Codes],"D") THEN "Delta"
      ELSEIF CONTAINS([Codes],"E") THEN "Echo"
      ELSEIF CONTAINS([Codes],"F") THEN "Foxtrot"
      ELSE "Other"


      A B
      C F
      A D