How to subtract the payment from the Bill amount if stacked onto each other in Alteryx
This is the sample Raw Data i have
| Transaction | Amount | Type |
| 1 | 1000 | Invoice 1 |
| 2 | 1000 | Payment |
| | | |
| 3 | 1221 | Invoice 1 |
| 4 | 1221 | Payment |
| | | |
| 5 | 254 | Invoice 1 |
| 6 | 100 | Invoice 2 |
| 7 | 354 | Payment |
| | | |
| 8 | 544 | Invoice 1 |
| 9 | 544 | Payment |
| | | |
And this is the desired output i want which subtract all the Invoice amount from the Payment amount.
| Transaction | Amount | Type |
| 1 | 1000 | Invoice |
| 2 | 1000 | Payment |
| | 0 | |
| 3 | 1221.5 | Invoice |
| 4 | 1221 | Payment |
| | 0.5 | |
| 5 | 254 | Invoice |
| 6 | 100 | Invoice |
| 7 | 354 | Payment |
| | 0 | |
| 8 | 544 | Invoice |
| 9 | 544 | Payment |
| | 0 | |