I want to write a script that looks at a unique PO and determines whether that PO is closed or not based on the status of the line. Additionally, I want to sum the values of all rows for each PO. The below example shows what I am after.
- PO 41000934 is not closed because one of the lines (2) is still open
- PO 41000934 has remaining amount of 15,000
- PO 41000950 is closed because all lines are closed
- PO 41000950 has remaining amount of 14,000
PO | Line | Closed | Rem_Amount |
---|---|---|---|
41000934 | 1 | Yes | 10,000 |
41000934 | 2 | No | 5,000 |
41000950 | 1 | Yes | 4000 |
41000950 | 2 | Yes | 8000 |
41000950 | 3 | Yes | 2000 |