3 Replies Latest reply: Apr 28, 2016 11:30 AM by Alluraiah Allu RSS

    Country Wise sales thru Previous()

    Alluraiah Allu

      Hi,

      I tried  for country wise sales , if two rows have similar country's data ;

       

      But I am not sure why it is not working  'USA'  ? in 'TABLE BOX'

       

      TEMP1:

      LOAD * INLINE

      [

      COUNTRY, PRODUCT, SALES

      MEXICO, A, 10000

      ENGLAND, B, 100

      USA, C, 4545

      FRANCE, A, 7778

      FRANCE,A, 8000

      USA, B, 99999

      INDIA, C, 12120

      ]

      ;

      NoConcatenate

      TEMP2:

      LOAD COUNTRY, PRODUCT, SALES ,

      if(COUNTRY=PREVIOUS(COUNTRY),PREVIOUS(SALES)+SALES, NULL()) AS COUNTRYWISESALES

      Resident TEMP1;

      DROP TABLE TEMP1;

       

       

       

      TABLE BOX :