3 Replies Latest reply on Apr 10, 2018 3:40 PM by Eric Hammond

    Parse field

    Deborah Auer

      Tableau version 10.4

      I have a field called Site that I need parsed but the data is not so easy to parse...  On some it is missing the end ")"

      Some only have Dog Park and Name...

       

      Dog Park Tinker

      Dog Park Samson Dr

      WT 473T Buffalo (3274684)

      WT TH847 Keenan (7493748

       

      What I need is the name (if not ID) or ID:

      Tinker

      Samson Dr

      3274684

      7493748

       

      I can't seem to get it...

        • 1. Re: Parse field
          Deepak Rai

          Can you post your data how it looks. From your above pasted data, it is not clear if you have 4 rows or 1.

          • 2. Re: Parse field
            Deborah Auer

            Can't post real data, private and too many rows.  But to answer your question it is 4 rows.  Just wanting to show the variety of data in rows.  Not a simple parse.

            • 3. Re: Parse field
              Eric Hammond

              Hi Deborah,

               

              Try:

              IF FIND(RIGHT(TRIM([Site]),5),' ') > 0  //If there is a space in the last five characters,

              THEN SPLIT(TRIM(REPLACE(REPLACE([Site],')',''),'(',' ')),' ',-2) + ' ' //the include 2nd-to-last word

              ELSE ''

              END

              + SPLIT(TRIM(REPLACE(REPLACE([Site],')',''),'(',' ')),' ',-1) //and also include the last word

               

              It works for the four examples given; hopefully it also handles most of your actual site names.