Skip to content

Instantly share code, notes, and snippets.

@m-dekorte
Created January 26, 2025 11:11
Show Gist options
  • Select an option

  • Save m-dekorte/f35837d4f70af1fcfa10c2ee07127deb to your computer and use it in GitHub Desktop.

Select an option

Save m-dekorte/f35837d4f70af1fcfa10c2ee07127deb to your computer and use it in GitHub Desktop.
errorReplacer M function | Substitute error values in all or listed scanColumns with a specified value or null if no replacement is provided.
(t as table, optional replacementValue as any, optional scanCols as list) as table =>
let
colNames = Table.ColumnNames(t),
selCols = List.Intersect({colNames, scanCols ?? {}}),
replErrors = Table.ReplaceErrorValues(t,
List.Transform(
if List.IsEmpty(selCols) then colNames else selCols,
each {_, replacementValue}
)
)
in
replErrors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment