2 Replies Latest reply on Jan 19, 2014 3:56 PM by Phillip Burger

    Can I combine multiple similar columns in Tableau?

    Evan Sebenius

      Hey there.  I have some badly-formatted data that looks like this:







      What I'd like to create is a graph that looks like this:



             | Green | Red | Blue


      Hats   |   X   |     | 

      Belts  |   X   |     |  X

      Shirts |   X   |  X  |  X

      Pants  |   X   |     |  X


      Is there a way to do this in Tableau with the data set given above?  Or do I need to transform the original data into this:













        • 1. Re: Can I combine multiple similar columns in Tableau?
          Hrvoje Gabelica

          It is challegeing to do it with Tableau alone, but it think that you can do it with R alone or with integration R with Tableau.

          For example I used melt function in reshape library and code look like this:




          and you get...

             Product variable value

          1     Hats   Color1  Blue

          2    Belts   Color1 Green

          3   Shirts   Color1   Red

          4    Pants   Color1 Green

          5     Hats   Color2     

          6    Belts   Color2  Blue

          7   Shirts   Color2  Blue

          8    Pants   Color2     

          9     Hats   Color3     

          10   Belts   Color3     

          11  Shirts   Color3 Green

          12   Pants   Color3  Blue


          You can cut out second column and if you want delete NA values.


          I would be glad if anyone has another answer.

          1 of 1 people found this helpful
          • 2. Re: Can I combine multiple similar columns in Tableau?
            Phillip Burger

            I'd reshape the data. I know R and use it almost everyday but have not had the opportunity yet to explore the integration with Tableau. I can't comment on Hrvoje's approach.


            Included is a workbook with a solution. Here is an image of the data displayed on the worksheet:



            I used the Excel add-in for Tableau. You can learn more about it here. The .txt attached is the data reshaped using this add-in. It takes just a few second to reshape the data to make it ingestible.

            1 of 1 people found this helpful