Duplicates

Before removing duplicates, decide what makes a row unique

Two purchases share the same customer, date, and amount. It is tempting to remove one. But perhaps the customer bought the same item twice. The difficult part of duplicate removal is rarely finding matching values. It is deciding what a match actually means.

One row, one what?

Before selecting a duplicate key, finish this sentence: “One row in this file represents one…” Customer? Order? Item within an order? That last distinction matters. An order number can legitimately appear on several rows when each row describes a different line item.

For line items, a key might need both the order number and line number. For events, it may need an event identifier. There is no universally correct combination. Check how the source system defines the record.

When you find a repeated key, compare the other columns before deleting anything. A different address could be an update. A different amount could be a correction. It might also be a genuine conflict that needs review.

A few habits that prevent expensive mistakes

Keep first and keep last describe positions in the file. They do not automatically mean oldest and newest. If your decision depends on a timestamp, inspect that timestamp, settle how to handle ties and missing dates, and establish the order before relying on it.

Check missing keys separately. Five rows without a customer ID are five unidentified rows, not evidence of one customer repeated five times. Grouping them together can quietly discard useful records.

Normalize only the differences you have agreed are irrelevant. Removing a trailing space from a category may be sensible; lowercasing a case-sensitive reference code may not be. Keep the original key available while you inspect the matching groups.

Finally, look at the largest duplicate group as well as a handful of small ones. A huge group can expose a bad key choice, such as a column filled with “unknown”. Review which row would survive and what information would disappear. That is a much more useful check than celebrating a smaller file.

How Fnd8n helps

Fnd8n provides full-row and selected-key duplicate operations, with configurable retention settings. Run counts and available lineage let you review removals and trace retained records.