Define what one row represents
How to use dataset grain, exact-row comparisons, and business keys with deterministic survivor rules to remove duplicates from merged datasets without discarding legitimate repeated observations. · associate
Data deduplication removes redundant records, not simply repeated values. Start by defining the dataset's grain: what one row represents. For a current order-line snapshot, the grain might be one row per (order_id, line_no). A customer ID alone is too broad because one customer can place several orders, each with several lines.
The intended grain determines which repetitions are legitimate. Two records for different lines of the same order must remain separate, even when their amounts match. Two versions of the same order line compete for one row in a current snapshot. In a history dataset, however, those versions may both belong: the grain must also identify the version or observation.
Write the grain as a rule before deleting anything. Then choose a business key, possibly several columns together, that identifies a row at that grain. Confirm that identifiers mean the same thing across sources; unrelated systems can reuse the same local ID.