If you want to pull a single value out of a record by naming the field you want, Record.Field is the function for that.
It takes a record and a field name as text, and hands back the value stored under that field. Because the field name is just text, you can hold it in a variable and decide it at runtime in Power Query.
Syntax of Record.Field Function
Record.Field(record as record, field as text) as any
where
record(required, record). The record you want to read a value from.field(required, text). The name of the field to fetch, given as a text value.
Returns: the value of that field (type any). If the field is not in the record, it raises an error.
In plain terms, you give it a record and a field name, and it returns whatever value sits under that name.
Example 1: Pull one field from an inline record
Read the Author field out of a small book record.
let
Book = [Title="The Silent Harbor", Author="R. Mehta", Price=14.5],
Result = Record.Field(Book,"Author")
in
Result
Result: R. Mehta
The field name "Author" matches a field in Book, so its value comes back.
Example 2: Use a dynamic field name held in a variable
Here the field name lives in a variable instead of a hard-coded string.
let
Book = [Title="The Silent Harbor", Author="R. Mehta", Price=14.5],
FieldToGet = "Price",
Result = Record.Field(Book,FieldToGet)
in
Result
Result: 14.5
FieldToGet resolves to "Price", so Record.Field returns the price. This is the case where record[Field] shorthand will not work.
Example 3: Use Record.Field inside Table.AddColumn
When you add a column, each gives you the current row as a record in _. You can pick a field from it by name.
Here is the starting Books table:
| Title | Author | Price |
|---|---|---|
| The Silent Harbor | R. Mehta | 14.5 |
| Tideline | K. Osei | 9.99 |
| Northwind Notes | L. Park | 22 |
let
Source = Excel.CurrentWorkbook(){[Name="Books"]}[Content],
PickField = "Author",
Added = Table.AddColumn(Source,"Picked",each Record.Field(_,PickField))
in
Added
The new Picked column copies each row’s Author value:
| Title | Author | Price | Picked |
|---|---|---|---|
| The Silent Harbor | R. Mehta | 14.5 | R. Mehta |
| Tideline | K. Osei | 9.99 | K. Osei |
| Northwind Notes | L. Park | 22 | L. Park |
Since PickField is text, you could swap it to "Price" and the column would follow. To rename that new column afterward, reach for Table.RenameColumns.
Example 4: Build the field name dynamically per row
The field to read can change row by row. Here each row’s own Pick column says which column to grab.
Here is the starting Sensors table:
| Station | Q1 | Q2 | Pick |
|---|---|---|---|
| North | 18 | 23 | Q2 |
| South | 31 | 27 | Q1 |
| East | 12 | 19 | Q2 |
let
Source = Excel.CurrentWorkbook(){[Name="Sensors"]}[Content],
Chosen = Table.AddColumn(Source,"Reading",each Record.Field(_,[Pick]))
in
Chosen
The Reading column pulls the value named in that row’s Pick:
| Station | Q1 | Q2 | Pick | Reading |
|---|---|---|---|---|
| North | 18 | 23 | Q2 | 23 |
| South | 31 | 27 | Q1 | 31 |
| East | 12 | 19 | Q2 | 19 |
For the North row, [Pick] is "Q2", so Record.Field returns 23. If you wanted to reshape those values instead of just copying them, Table.TransformColumns is the column-level tool for that.
Example 5: Read a field whose name has a space
Field names with spaces need the quoted identifier #"..." when you define them, and a plain text string when you read them.
let
Order = [#"Order ID"="A-1007", #"Total Due"=248.75],
Result = Record.Field(Order,"Total Due")
in
Result
Result: 248.75
The text "Total Due" matches the field cleanly, with no special escaping needed in the second argument.
Things to keep in mind with Record.Field
- Use
record[Field]for a fixed name,Record.Fieldfor a variable one. The[Field]shorthand needs the name written into the code. When the name lives in a variable or column, like Examples 2 and 4, you needRecord.Field. - A missing field raises an error. Asking for a field that is not there gives
Expression.Error: The field 'X' of the record wasn't found.UseRecord.FieldOrDefault(record,field,default)to return a fallback instead. - Field names are case-sensitive.
Record.Field(r,"author")will not find a field namedAuthor. Match the case exactly.
List of All Power Query Functions
Related Power Query Functions / Articles: