Hi Team,
Need your support to show the output below
take the first value on the right(Value1), mins the left value(Value). Doing the calculation until the right side value become 0 and show the right side value's reminder.
Thank you very much
Input
| Ref | PastDate | Value | User | Product | Ref1 | PastDate1 | Value1 | User1 | Product1 |
| 100005 | 20220915 | -10 | F | Apple | 100001 | 20220910 | 50 | A | Apple |
| 222003 | 20220918 | -20 | G | Apple | 10002 | 20220913 | 20 | B | Apple |
| 22233 | 20221001 | -60 | S | Apple | 100002 | 20220915 | 30 | C | Apple |
Output: (1Pair) - option one
| Ref | PastDate | Value | User | Product |
| 100001 | 20220910 | 50 | A | Apple |
| 100005 | 20220915 | -10 | F | Apple |
| 222003 | 20220918 | -20 | G | Apple |
| 22233 | 20221001 | -30 | S | Apple |
| 22233 | 20221001 | -30 | S | Apple |
Output (Muti-pairs) - option two
| Ref | PastDate | Value | User | Product |
| 100001 | 20220910 | 50 | A | Apple |
| 100005 | 20220915 | -10 | F | Apple |
| 222003 | 20220918 | -20 | G | Apple |
| 22233 | 20221001 | -30 | S | Apple |
| 10002 | 20220913 | 20 | B | Apple |
| 22233 | 20221001 | -20 | S | Apple |
| 100002 | 20220915 | 30 | C | Apple |
| 22233 | 20221001 | -10 | S | Apple |
| 100002 | 20220915 | 20 | C | Apple |
Thx Again