3 Replies Latest reply on Mar 22, 2020 9:39 PM by Diego Domenech

    Stacking Columns help for a n00b

    Diego Domenech

      Hi All,

       

      I am very savy with Tableau Desktop and Server, but have recently started using Tableau Prep to attempt to transform a particularly difficult data set. The data that i have is basically a very wide Excel file with a single row for an individual ID. There are columns in the data that correspond to the name of a measure, and then a column named similarly that has the value for that measure. here is an example with made up data.

       

      ID
      Label1
      Label2
      Label3
      Label1Value1
      Label2Value1
      Label3Value1
      Label1Value2
      Label2Value2
      Label3Value3
      1SpeciesNumberOfAnimalsAvg.WeightDog1053Cats310
      2SpeciesNumberOfAnimalsAvg.WeightHorse31500Pig2290

       

      This is the structure for over 230 columns basically.

       

      What i need to do is to get these columns stacked so that i can easily build views in Tableau without having to pull in a lot of fields (some measures have more than 5 corresponding values columns sometimes).

       

      This is what it would look like for ideally where the labels become measure names and the values become measure values.

       

      ID
      Species
      NumberOfAnimals
      Avg.Weight
      1

      Dog

      1053
      1Cat310
      2Horse31500
      2Pig2290

       

      In SQL i would do this by basically unioning the fields or creating a new table with the correct formatting etc.

       

      Any help here would be awesome, if there are searches you recommend i try that would be great, i'm just not very familiar with the terminology of prep yet.

       

      Cheers,

       

      -DD