[Urgent+Complicated] Double count due to duplicate values

Hi there, I’m urgently seeking heled against the amounts invoiced, as we want to know which are the outstanding POs that have not been fully drawn down.

Each PO number has an ID Code. The issue is that when people submit an invoice, they may quote this ID Code or they may quote an Int Code instead. This means that for every PO number, I need to check the amounts billed tied to the ID Code or Int Code to gather the total amount invoiced for this PO number, and compare it to the PO amount issued to see what is the balance left.

The issue now is I have managed to clean up the raw report but the Total Amount Billed is being double counted in the scenario where ID Code has duplicates and ID-BIlled Amt does not equal to 0. I have included the screenshots below.

First table = shows what my cleaned up report throws out.
The errors happen in the first 3 unique ID Codes where I have highlighted the erroneous cells. The ID-Billed Amt was already calculated in the first row but it is also being calculated into the secnod row.
The rest of the rows where ID-Billed Amt = 0 is correct.

Second table = what the correct report should show.

Does anyone have any suggestions on the logic needed for the first 3 rows? I’m really stuck. I’m also using a protected laptop and can’t download any filed from my browser and hence I can only work with screenshots :frowning:

Thank you.

i try to understand but not able to get what exactly your problem is

If you can explain in some calculation steps
Something like what are inputs provided directly (column names)

Others what are columns you want calculate how do you do that

Like Total Amount Billed = ID PO Amount + INT PO Amount in this way

Could you also provide what is the flow you have developed

Regards