3 Replies Latest reply on Jan 4, 2019 9:06 AM by Jim Dehner

    Split string and put the values in a filter

    Jan Horcicka

      I have a list of employees and for each employee list of all supervisors in one column (separated by comma).

       

      Example:

       

      EmployeeSupervisor Hierarchy
      1Joe, Karl, Moe, George
      2Jess, Joe, Karl, Moe, George
      3

      Jack, Peter, Allan, Moe, George

      4Babe, Ruth, Rick, George

       

      Now, this is in total 11 names of supervisor. I would like to create a calculated field where there would be these 11 names for selection. Then, if a user selects one of the names (e.g. Joe), the report will filter only for employees that have this supervisor in their hierarchy (in this case employees 1 and 2).

       

      Of course, I know how to create a TRUE / FALSE filter to check whether the supervisor is in the hierarchy. The problem is to create a list of these names and put them into the filter. Is there a way to do it? Ideally without adding more rows.

        • 1. Re: Split string and put the values in a filter
          Jim Dehner

          Hi Jan

           

          Your data is not well structured to split and do what you want

           

          so what to do - I used Prep to split and pivot your data

           

           

          then you can get this

           

          you could do this in tableau but it is much easier in Prep

           

          Jim

          If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.

          • 2. Re: Split string and put the values in a filter
            Jan Horcicka

            Hello Jim,

             

            thank you for your helpful and descriptive answer.

             

            Unfortunately I am not able to use Tableau Prep, I was hoping the achieve the same result as you did in Tableau Desktop.

             

            I am able to change the structure of the data, I can modify the custom SQL query any way I like. If it would be possible with some SQL modifications please let me know.

             

            Thank you once again. Since I am not able to test your answer as it requires Tableau Prep, I cannot mark it as the correct answer, I hope you understand.

            • 3. Re: Split string and put the values in a filter
              Jim Dehner

              here is the in tableau option - I do not like doing it this way - you end up with multiple dimensions

              right click and select custom split

              you end up with this but the data can not be pivoted

              then for the viz drag them all to rows and you end up with this - visually its ok but not actionable

               

               

              I'm not a sql guy but you should be able to split and pivot the data with sql

              '

              Jim

               

              If this posts assists in resolving the question, please mark it helpful or as the 'correct answer' if it resolves the question. This will help other users find the same answer/resolution.  Thank you.