Table.AddKey
A new key is inserted into a table. The 'columns' parameter should contain the list of column names that will form the key, while the 'isPrimary' parameter indicates if it is a primary key.
A new key is inserted into a table. The 'columns' parameter should contain the list of column names that will form the key, while the 'isPrimary' parameter indicates if it is a primary key.
Insert a unique identifier column as the primary key in a table.
Usage:
Power Query Mlet
table = Table.FromRecords({
[Id = 1, Name = "Hello There"],
[Id = 2, Name = "Good Bye"]
}),
resultTable = Table.AddKey(table, {"Id"}, true)
in
resultTable
Output
Table.FromRecords({
[Id = 1, Name = "Hello There"],
[Id = 2, Name = "Good Bye"]
})