# 7.15 Errors: आधी कारण शोधा, मग handle करा

Source: https://ravindrabagale.com/mr/powerbi/ch07-data-cleaning-a-z-in-power-query/7-15-errors-remove-replace-keep-and-try-otherwise.html
Language: mr (Marathi with English technical terms)

NA सारखा text number करताना cell-level error येतो. खाली errors null ने replace केल्यावरचा result आहे.

 | Order ID
 | Delivery Time Mins

 | BLK-60001
 | 9

 | BLK-60002
 | Error

 | BLK-60003
 | 14

 | BLK-60004
 | Error

 | Order ID
 | Delivery Time Mins

 | BLK-60001
 | 9

 | BLK-60002
 | null

 | BLK-60003
 | 14

 | BLK-60004
 | null

Query Duplicate करा आणि संबंधित column › Home › Keep Rows › Keep Errors करा.

Error cell निवडून खाली message वाचा; उदा. DataFormat.Error आणि Details: NA.

Replace Errors मध्ये null किंवा business अर्थ असेल तर 0 द्या.

पूर्ण row निरुपयोगी असेल तेव्हाच Remove Rows › Remove Errors करा.

Formula मध्ये risky conversion भोवती try … otherwise वापरा. Error Reason राखल्यास data-quality report करता येतो.

Replaced = Table.ReplaceErrorValues(Typed, {{"Delivery Time Mins", null}}),
NoErrors = Table.RemoveRowsWithErrors(Typed, {"Amount"}),
Safe     = Table.AddColumn(Source, "Delivery Mins Safe",
              each try Number.From([Delivery Time Mins]) otherwise null, type number),
// keep the error message for a data-quality report
WithMsg  = Table.AddColumn(Source, "Error Reason",
              each let r = try Number.From([Delivery Time Mins]) in
                   if r[HasError] then r[Error][Message] else null)

 | Error | उदाहरण | काय करायचं?

 | Cell-level | NA चं Number conversion | कारण तपासून Replace / Remove Errors किंवा try.

 | Step-level | File moved / Amount column not found | Source path किंवा column reference दुरुस्त करा.

Practice

Quantity मध्ये 2, 3 pcs, - असलेल्या test file साठी try Number.From(Text.Select([Quantity], {"0".."9"})) otherwise null वापरा. Null rows वेगळ्या दाखवा. हा digits-only प्रयोग negative किंवा decimal quantities साठी योग्य नाही; production rule वेगळा ठरवा.

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

आजच्या दहा error rows पुढच्या महिन्यात दहा हजार असू शकतात. फक्त remove करून समस्या लपवू नका. NA म्हणजे missing असेल तर type conversion आधी null करा.
