Skip to content

Instantly share code, notes, and snippets.

View darrellwolfe's full-sized avatar
😶‍🌫️
Always busier than I'd like to be... but never too busy for a chat.

Darrell G Wolfe darrellwolfe

😶‍🌫️
Always busier than I'd like to be... but never too busy for a chat.
View GitHub Profile
@bjulius
bjulius / gist:e25412c0cd3e83857ff5c45052df5a83
Last active July 24, 2025 05:52
Dynamic M Function to Replace Blanks with Nulls ( #DataCleaning, #MCode, #M, #PowerQuery )
let
ReplaceBlanksWithNulls = (inputTable as table) as table =>
let
columnNames = Table.ColumnNames(inputTable),
replaceBlanksInColumn = (table, columnName) => Table.ReplaceValue(table, "", null, Replacer.ReplaceValue, {columnName}),
transformedTable = List.Accumulate(columnNames, inputTable, (state, current) => replaceBlanksInColumn(state, current))
in
transformedTable
in
ReplaceBlanksWithNulls