1 Reply Latest reply: Jun 24, 2013 12:08 PM by Juan Gerardo Cabeza Luque RSS

    Pivot Up while loading data

      Hi

      I have my data source table in this format:

       

      Customer IDCategory TypeCategory Value
      1AA1
      2AA2
      3AA3
      4AA4
      1BB1
      2BB1
      3BB2
      4BB3
      1CC1
      2CC2
      3CC3
      4CC4
      5CC1

       

      and while loading the data in QV I want to load it in the following format:

       

      Customer IDABC
      1A1B1C1
      2A2B1C2
      3A3B2C3
      4A4B3C4
      5--C1

      Any ideas?

        • Re: Pivot Up while loading data
          Juan Gerardo Cabeza Luque

          T1:

          LOAD * INLINE [

          CustomerID, CategoryType, CategoryValue

          1, A, A1

          2, A, A2

          3, A, A3

          4, A, A4

          1, B, B1

          2, B, B1

          3, B, B2

          4, B, B3

          1, C, C1

          2, C, C2

          3, C, C3

          4, C, C4

          5, C, C1

          ];

            

           

          T2:

          LOAD

                    CustomerID,

                    MaxString(If(CategoryType = 'A', CategoryValue)) AS A,

                    MaxString(If(CategoryType = 'B', CategoryValue)) AS B,

                    MaxString(If(CategoryType = 'C', CategoryValue)) AS C

          Resident T1

          Group By CustomerID;

           

           

          DROP Table T1;

           

           

          JG