8 Replies Latest reply: Aug 10, 2016 6:47 AM by Simon Baxter RSS

    Complex Sort Calculation in Script

    Simon Baxter

      Hi,

       

      I'm hoping that one of you will be able to help me with a really complex sort in my script (or so I think). I'm trying to work out how to calculate the most economical way to get to a number of points.

       

      I've copied 2 examples below.

      In the first example (Product 1001) I want in this instance to be able to get over 700 points as economically as possible. I can see the answer is to pick items 7, 8 & 12 but I cannot get Qlikview to work that out for me.

       

      In the second example (Product 2001) I want in this instance to be able to get over 250 points as economically as possible. I can see the answer is to pick items 1 & 3 but again I cannot get Qlikview to work that out for me.

       

      KeyProduct NumberItem NumberPoints Cost
      1001|110011560.00
      1001|210012560.00
      1001|310013560.00
      1001|4100140100.00
      1001|5100150136.73
      1001|610016560.00
      1001|710017150138.00
      1001|810018105113.00
      1001|910019522.21
      1001|10100110150138.00
      1001|11100111150138.00
      1001|1210011249953.00
      1001|13100113548.00
      1001|141001140136.73
      1001|151001150136.73
      1001|16100116700411.11

       

      Key Product NumberItem NumberPoints Cost
      2001|12001115048
      2001|220012050
      2001|320013100165
      2001|420014150185
      2001|520015150185
      2001|620016560
      2001|720017150180
      2001|820018150200
      2001|920019560
      2001|10200110150170
      2001|11200111560
      2001|12200112100165
      2001|13200113100165
      2001|14200114100213.81
      2001|15200115560

       

      Thanks in advance, Simon