Two purchasing exports overlap. The combined file has six rows that add up to $480. One purchase has two legitimate line items, one line was copied twice, and one rental was corrected from $90 to $80. How much was spent?
Download the six-row practice CSV. The records are fictional. In this exercise the source system identifies a line by the pair purchase_id and line_id, and later rows contain newer revisions. Keep the file in its original order while doing the exercise.
Find the exact copy
Open the CSV in a spreadsheet or the CSV Duplicate Remover. In the browser tool, leave the header enabled, choose The whole row, and keep the first copy. You should have five rows. Sum amount_usd and you get $445. The second $35 entry for printed maps is gone, but both prices for the recorder rental remain.
See what goes wrong with one key
Start again from the original six rows. Choose Key columns, select only purchase_id, and keep Last. You get three rows totaling $175. Look at purchase 000101 in the source. The $180 site survey and the $60 field notes have different line IDs. Keeping the last row for each purchase discards the survey.
Reconcile the four line items
Select both purchase_id and line_id as keys. Keeping First gives four rows totaling $365. Switch to Last and the row count stays at four, but the total drops to $355. The difference is the $10 correction to the recorder rental. Row count alone would miss it.
Download the expected four-row CSV. Its amounts, in file order, are $180, $60, $35 and $80. The same total follows from the original $480 when you subtract the repeated $35 charge and the superseded $90 rental.
Apply the check to a real export
Confirm with the data owner which fields identify one line and how revisions are ordered. If the source gives a revision timestamp, use it to establish order before choosing which row to keep. If it gives no revision history, keep conflicting amounts for review. Save the original export and the removed rows so another person can reproduce the total.