You are importing data from a CSV file that contains a column 'OrderDate' with dates in the format 'MM/dd/yyyy'. Some rows have invalid dates like '02/30/2023'. What is the best way to handle these errors in Power Query?
Replacing errors with null in Power Query is a non-destructive transformation that explicitly substitutes each invalid date value with a null while keeping the row intact. You apply it to the date column (Home > Replace Errors or context menu) and specify null as the replacement value. This preserves all other column values for that row and produces a clean, nullable date column that the data model handles naturally, e.g., through blanks in visuals or DAX functions like CALCULATE with filters. It also avoids the risk of load failure due to leftover errors.
Why this answer
'Replace Errors' in Power Query allows you to replace error values (which occur when Power Query fails to convert an invalid date like '02/30/2023' to the Date type) with null. This preserves the rest of the data and keeps the query running without interruption, while clearly marking invalid entries for later handling or analysis.
Exam trap
The trap here is that candidates often choose 'Remove Errors' (Option B) thinking it cleans the data, but they overlook that it deletes entire rows, which may discard valid data in other columns — a common mistake in data preparation scenarios.
How to eliminate wrong answers
Option B is wrong because 'Remove Errors' deletes entire rows containing any error, which can lead to data loss if other columns in those rows contain valid data. Option C is wrong because 'Change data type to Date and ignore errors' is not a valid Power Query operation; ignoring errors during type conversion still results in errors in the column, and there is no built-in 'ignore errors' toggle. Option D is wrong because filtering to exclude rows with invalid dates after type conversion requires the errors to be present first, and filtering on error values is not straightforward; it is more efficient to replace errors with null and then filter if needed.