8 Replies Latest reply: Feb 21, 2016 2:42 PM by Dena Reavis RSS

    Help! Rollup or Group by: One Yes trumps any number of No values?

    Dena Reavis

      I have a difficult hierarchy logic I do not know how to handle in a load script.

       

      Here is the example, I have a list of "Interest Mappings" beginning data pictured on left, records 1-10. I need to select the Code, Department, Product, and Interest but I need to let a 'Y' value trump all if there is a Y value. If all values for a Product type are N, then the Interest needs to be N. The end result should be as pictured on the right, records 1-6, where description is not included. Basically this is to loosen up over-restrictive Interest Mapping by saying, "well, you were interested in other Apple pieces in your Compost product, but you were being to picky."

       

      The beginning two records have only one interest value for each product so those are kept. The next three values are the same code, same department, same Product, except there is one Y and N in the other two. I need the Y to be selected over any N. That would result in the record #3 in the Ending data example.

       

      I would picture this as a regular Group By, to group past the Code Description, except for the condition that Y value should override all other values within the Product type.

       

      I have absolutely no idea how to do this. Please help if you can!!

      Group by.PNG

      Thank you very much!!!!