Created
February 6, 2025 23:39
-
-
Save lcorbasson/0df234527b35024dd234c6522d3a6a2f to your computer and use it in GitHub Desktop.
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
| 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