Skip to content

Instantly share code, notes, and snippets.

@lcorbasson
Created February 6, 2025 23:39
Show Gist options
  • Select an option

  • Save lcorbasson/0df234527b35024dd234c6522d3a6a2f to your computer and use it in GitHub Desktop.

Select an option

Save lcorbasson/0df234527b35024dd234c6522d3a6a2f to your computer and use it in GitHub Desktop.
let
addFlagColumn_TextEquals = (source_table as table, name_of_the_flag_column as text, names_of_the_columns_to_compare as list) as table =>
let
indexedTable = Table.AddIndexColumn(source_table, "Index", 0, 1),
flaggedTable = Table.AddColumn(indexedTable, name_of_the_flag_column, each
if List.Distinct(
List.ReplaceMatchingItems(
Record.ToList(Table.SelectColumns(indexedTable, names_of_the_columns_to_compare){[Index]}),
{{null, ""}}
)
) > 1 then
1
else 0,
Int64.Type),
finalTable = Table.RemoveColumns(flaggedTable, {"Index"})
in
finalTable
in
addFlagColumn_TextEquals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment