3 Replies Latest reply: Sep 29, 2016 2:33 AM by Sebastian Fagerlund RSS

    Merge unique productID to one row

    Sebastian Fagerlund

      Okay, this is a tricky one.. I think.

       

      ProductID    Purchase

      5001              50

      5002              100

      35001            200

      35002            300

       

      35001 and 35002 is raw material to create 5001 and 5002.

      So the Purchase for 5001 and 5002 is products on there way to the company and Purchase for 35001 and 35002 is raw material on there way to the packing line. And i want this information on one row.

       

      ProductID    Purchase    PurchaseToPacking

      5001              50                200

      5002              100              300

       

      The rule to find the raw material is:

      if ( len(ProductID) = 5 and left(ProductID,1)=3, sum(Purchase),0)

       

      And now i need to Concat or Aggr somehow?