1 Reply Latest reply: Jul 19, 2016 12:00 PM by Andrew Walker RSS

    Problem Building a logic around getting values from same field

    Sk Awal

      Hi All,


      I am having difficult time to figure out a problem. Please see the attach file and below description of the problem.


      When a Previous ID is Upgraded or downgraded to Current ID, the Sales Type is either U or D and Sales Price is for the current ID. But the ID which is Previous ID now they were once Current ID and they are included in the current ID and their Sales Type is A. My problem is to get the Downgraded Sales Amount by subtracting the Sales Price Attached to the Current ID from the Sales Price Attached to the Previous ID. For example, The downgraded amount for Current ID 155 is, (157-150) = 7 

       

      I am struggling to build the logic for this problem. Can anybody shed some light on it?

       

      Thanks

        • Re: Problem Building a logic around getting values from same field
          Andrew Walker

          Hello,

          Try this in the script:

          Data:

          LOAD [Previous ID],

               [Current ID],

               [Sales Price],

               [Sales Type]

          FROM

          Book7.xlsx

          (ooxml, embedded labels, table is Sheet1);

           

           

          Left Join(Data)

          LOAD

          [Current ID] as [Previous ID],

          [Sales Price] as [Previous Price]

          Resident Data;

           

          we get this for Current ID 155:

           

          Current ID Previous ID [Sales Price] [Previous Price] Diff
          155111150157-7

           

          Regards

           

          Andrew