Power Query M code
let
Source = YourTable,
AddedSafeColumn = Table.AddColumn(Source, "SafeResult", each try [Numerator] / [Denominator] otherwise 0, type number)
in
AddedSafeColumn
Wraps a calculation in try...otherwise so the query keeps running with a fallback value instead of failing on the first error.
let
Source = YourTable,
AddedSafeColumn = Table.AddColumn(Source, "SafeResult", each try [Numerator] / [Denominator] otherwise 0, type number)
in
AddedSafeColumn
Replace the expression after try with your own calculation, and the value after otherwise with whatever fallback makes sense (0, null, "N/A").
Browse all 145 snippets in the Power Query M Code Snippets, or search the library for something similar to Try / Otherwise Error Handling.