# 7.4 Duplicates: पूर्ण row की key?

Source: https://ravindrabagale.com/mr/powerbi/ch07-data-cleaning-a-z-in-power-query/7-4-removing-duplicates-full-row-and-by-key.html
Language: mr (Marathi with English technical terms)

पहिल्या दोन rows अगदी सारख्या आहेत. शेवटच्या दोन rows चा Order ID + Product ID सारखा आहे, पण status बदललेला आहे.

 | Order ID
 | Product ID
 | Qty
 | Status

 | BLK-20001
 | P-101
 | 2
 | Delivered

 | BLK-20001
 | P-101
 | 2
 | Delivered

 | BLK-20002
 | P-205
 | 1
 | Cancelled

 | BLK-20002
 | P-205
 | 1
 | Delivered

 | Order ID
 | Product ID
 | Qty
 | Status

 | BLK-20001
 | P-101
 | 2
 | Delivered

 | BLK-20002
 | P-205
 | 1
 | Delivered

पूर्ण row duplicate तपासण्यासाठी सर्व columns निवडा आणि Home › Remove Rows › Remove Duplicates करा.

Key साठी Ctrl धरून Order ID आणि Product ID निवडा; मग Remove Duplicates.

Latest status हवा असेल तर वास्तविक Status Updated DateTime descending sort करा, code प्रमाणे buffer करून key वर distinct करा. Timestamp नसताना फक्त row order वरून latest ठरवू नका.

आधी तपासण्यासाठी Keep Rows › Keep Duplicates वापरा.

FullRowDistinct = Table.Distinct(Source),
ByKey  = Table.Distinct(Source, {"Order ID", "Product ID"}),
// keep the latest version of each order line
Sorted = Table.Buffer(Table.Sort(Source, {{"Status Updated DateTime", Order.Descending}})),
Latest = Table.Distinct(Sorted, {"Order ID", "Product ID"})

इथे sample key Order ID + Product ID आहे. तुमच्या source मध्ये एकाच product च्या अनेक line IDs असतील तर प्रत्यक्ष line key वापरा. Table.Buffer मोठ्या data वर महाग पडू शकतो.

Practice

Solapur Hotgi Road चा export दोनदा append झाला आहे असं समजा. Keep Duplicates ने repeated lines मोजा आणि मग योग्य duplicate काढा.

रवींद्र बागले यांची tip

आधी Trim आणि case fix करा. BLK-20001 आणि blk-20001 मागचा space वेगळे मानले जाऊ शकतात. Order ID एकट्यावर duplicates काढले तर खरे product lines हरवतील.
