Power Query M code
let
Source = YourTable,
AddedSafeValue = Table.AddColumn(Source, "SafeAmount", each try [Amount] otherwise 0, type number)
in
AddedSafeValue
Wraps a calculation so an error or missing value falls back to a default instead of failing the query.
let
Source = YourTable,
AddedSafeValue = Table.AddColumn(Source, "SafeAmount", each try [Amount] otherwise 0, type number)
in
AddedSafeValue
Replace [Amount] with the expression that might fail, and 0 with your preferred fallback value.
Browse all 145 snippets in the Power Query M Code Snippets, or search the library for something similar to Handle Missing or Invalid Data Safely.