Courses / Power Query (Get & Transform)
40. Error handling with try ... otherwise
Using M's try ... otherwise to catch errors and provide fallback values during transformations.
Power Query M
Error handling with try ... otherwise
A compact way to catch runtime errors in M expressions and give a fallback value instead of crashing the query.
"I want my import to keep working even when one column has bad data."
try ... otherwise runs an expression and, if it errors, returns the fallback after otherwise; otherwise the expression's result is returned. It's the primary M pattern for graceful fallback during transformations.
"I want my import to keep working even when one column has bad data."
try ... otherwise runs an expression and, if it errors, returns the fallback after otherwise; otherwise the expression's result is returned. It's the primary M pattern for graceful fallback during transformations.