5 Replies Latest reply: Jul 12, 2018 9:21 AM by Olivier Robin RSS

    Cross Table

    Than Mughi

      Table:

      LOAD * INLINE [

      Product, Month, Sales

      A, Jan 2017, 10

      A, Mar 2017, 20

      A, Apr 2017, 30

      B, Mai 2017, 40

      B, Jun 2017, 50

      ];

       

      FinalTable:

      LOAD DISTINCT Product

      Resident Table;

       

      For i = 1 to FieldValueCount('Month')

       

        LET vField = FieldValue('Month', $(i));

        

          Left Join (FinalTable)

          LOAD DISTINCT Product,

          Sales as [$(vField)]

          Resident Table

          Where Month = '$(vField)';

        

      Next

       

      DROP Table Table;





      can anyone explain this code?

      For i = 1 to FieldValueCount('Month')

       

        LET vField = FieldValue('Month', $(i));

        

          Left Join (FinalTable)

          LOAD DISTINCT Product,

          Sales as [$(vField)]

          Resident Table

          Where Month = '$(vField)';





      My doubt is how we are getting the sales value here?