Created
January 26, 2025 11:11
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (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