Record.FromTable

Record

Converts a two-column table (Name, Value) into a record, using the Name column as field names and Value as field values.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Record.FromTable(table as table) as record

Parameters

NameTypeRequiredDescription
tabletableYesA table with exactly two columns named "Name" (text) and "Value" (any). Each row becomes a field in the result record.

Return Value

recordA record constructed from the Name-Value pairs in the table.

Remarks

Record.FromTable is the inverse of Record.ToTable. It converts a two-column table with Name and Value columns into a record, where each row contributes one field: the Name column value becomes the field name and the Value column value becomes the field value.

The input table must have exactly two columns named Name (text) and Value (any). Field names must be unique — duplicate Name values raise an error. The resulting record preserves the row order of the input table as the field order.

This function is most useful when you have key-value data in tabular form — such as configuration tables, parameter tables, or pivoted data — and you need to operate on it as a record. A common pattern is to read a two-column settings table from a data source and convert it to a record for use in subsequent query steps.

Examples

Example 1: Convert a Name-Value table to a record

Record.FromTable(
    #table({"Name", "Value"}, {{"CustomerID", 1}, {"FullName", "Alice"}, {"City", "New York"}})
)
Result
CustomerID
FullName
City
11AliceNew York

Example 2: Round-trip a record through ToTable and back — verifies lossless conversion

let
    Original = [A = 1, B = "hello", C = true],
    AsTable = Record.ToTable(Original),
    BackToRecord = Record.FromTable(AsTable)
in
    BackToRecord[B]
Applied Steps

The final output — accesses the B field of the restored record, returning the text value "hello".

Result
1hello

Example 3: Build a summary record from Sales table statistics

let
    Pairs = #table({"Name", "Value"}, {
        {"TotalOrders", Table.RowCount(Sales)},
        {"FirstOrderID", Sales{0}[OrderID]},
        {"LastOrderID", Sales{Table.RowCount(Sales) - 1}[OrderID]}
    }),
    Summary = Record.FromTable(Pairs)
in
    Record.ToTable(Summary)
Applied Steps

The final output — converts the summary record back to a two-column Name/Value table for display.

Name
Value
1TotalOrders5
2FirstOrderID1
3LastOrderID5

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks