5 Replies Latest reply: Jun 14, 2017 9:17 AM by beck bakytbek RSS

    sum in generic load

    beck bakytbek

      Hi Folks,

       

      i have a situation , i am using this code:

       

      Table:

      LOAD * INLINE [

      Product, Month, Sales

      A, Jan 2017, 10

      A, Mar 2017, 20

      A, Apr 2017, 30

      A, Apr 2017, 1

      B, Apr 2017, 2

      B, Apr 2017, 3

      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;

       

       

      My Problem (see attached screenshot) and Question is: how can i show with generic load the sum: 31 in Column Apr 2017 for Product A and Sum:5 for Product B with my Column: Apr 2017, as you see, the table generates a row and the same time my table produces the duplicates for another dimensions.

       

      Thanks a lot

      Beck