Hi
If the value is equal to 12 in the qty column then I need to divide the qty column to the EOQ column. The result will be spreading in the requested output until the total is 12. If the value less than 12 then I will keep it as it is. Please, look at the value the qty column. The dest id column is also an indication. The restriction is based on the dest id column.
Input | | |
dest_id | qty | EOQ |
13690 | 12 | 2 |
13690 | 0 | 2 |
13690 | 0 | 2 |
13690 | 0 | 2 |
13690 | 0 | 2 |
13690 | 0 | 2 |
13690 | 0 | 2 |
13690 | 0 | 2 |
13690 | 0 | 2 |
13690 | 0 | 2 |
13690 | 0 | 2 |
13690 | 0 | 2 |
13690 | 0 | 2 |
13690 | 0 | 2 |
13690 | 12 | 2 |
13827 | 0 | 3 |
13827 | 0 | 3 |
13827 | 0 | 3 |
13827 | 0 | 3 |
13827 | 0 | 3 |
13827 | 12 | 3 |
13827 | 12 | 3 |
13827 | 0 | 3 |
13827 | 0 | 3 |
13827 | 0 | 3 |
13827 | 0 | 3 |
13827 | 0 | 3 |
13827 | 0 | 3 |
13827 | 0 | 3 |
13827 | 0 | 3 |
13827 | 0 | 3 |
13827 | 0 | 3 |
13827 | 0 | 3 |
13827 | 0 | 3 |
13827 | 0 | 3 |
13827 | 12 | 3 |
Desired Output | | |
dest_id | qty | EOQ | Desired Output |
13690 | 12 | 2 | 6 |
13690 | 0 | 2 | 6 |
13690 | 0 | 2 | 0 |
13690 | 0 | 2 | 0 |
13690 | 0 | 2 | 0 |
13690 | 0 | 2 | 0 |
13690 | 0 | 2 | 0 |
13690 | 0 | 2 | 0 |
13690 | 0 | 2 | 0 |
13690 | 0 | 2 | 0 |
13690 | 0 | 2 | 0 |
13690 | 0 | 2 | 0 |
13690 | 0 | 2 | 0 |
13690 | 0 | 2 | 6 |
13690 | 12 | 2 | 6 |
13827 | 0 | 3 | 0 |
13827 | 0 | 3 | 0 |
13827 | 0 | 3 | 0 |
13827 | 0 | 3 | 0 |
13827 | 0 | 3 | 0 |
13827 | 12 | 3 | 4 |
13827 | 12 | 3 | 4 |
13827 | 0 | 3 | 4 |
13827 | 0 | 3 | 4 |
13827 | 0 | 3 | 4 |
13827 | 0 | 3 | 4 |
13827 | 0 | 3 | 0 |
13827 | 0 | 3 | 0 |
13827 | 0 | 3 | 0 |
13827 | 0 | 3 | 0 |
13827 | 0 | 3 | 0 |
13827 | 0 | 3 | 0 |
13827 | 0 | 3 | 0 |
13827 | 0 | 3 | 4 |
13827 | 0 | 3 | 4 |
13827 | 12 | 3 | 4 |