Table.Keys is a Power Query M function that retrieves the keys of a specified table. The function returns a list of the table’s keys.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Table.Keys( table as table ) as list
Description
Table.Keys returns the keys of the specified table, which serve as unique identifiers for the rows within the table.
Examples
Get the list of keys for a table.
// Output: {[Columns = {"Id"}, Primary = true]}
let
table = Table.FromRecords( {
[Id = 1, Name = "Hello There"],
[Id = 2, Name = "Good Bye"]
} ),
tableWithKeys = Table.AddKey( table, {"Id"}, true ),
keys = Table.Keys( tableWithKeys )
in
keys
Related functions
Other functions related to Table.Keys are:
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy