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:

       

      Product,Color1,Color2,Color3

      Hats,Blue,None,None

      Belts,Green,Blue,None

      Shirts,Red,Blue,Green

      Pants,Green,None,Blue




      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:

       

      Product,Color

      Hats,Blue

      Belts,Green

      Belts,Blue

      Shirts,Red

      Shirts,Blue

      Shirts,Green

      Pants,Green

      Pants,Blue

       

      Thanks!

        • 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:

           

          md<-melt(a,id=c("Product"))

           

          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