Downloads
Power Query MRecordIntermediate

Record.SelectFields

Returns a copy of a record that keeps only the fields you name.

Syntax
Record.SelectFields(record, fields, optional missingField)

Returns: A new record with only the chosen fields.

What it does

Record.SelectFields keeps only the fields you list and drops the rest. It is the opposite of Record.RemoveFields. Use it when a row has many fields and you want a fixed, known set in a fixed order, for example to build the standard line for a journal template.

Syntax and arguments

Example

A bank export has many columns. The journal template needs only the date, the amount and the description, and some exports do not carry a reference column.

let
    BankRow = [Date = #date(2026, 3, 31), Amount = 1250, Description = "Rent", Reference = null, Branch = "Reno"],
    JournalLine = Record.SelectFields(BankRow, {"Date", "Amount", "Description"})
in
    JournalLine

JournalLine has three fields only: Date, Amount and Description. Branch and Reference are dropped. Using MissingField.UseNull would keep the layout stable if a row lacked one of the three fields.

Example: a second, different use

Keeping a stable set of columns from a file whose layout changes: list the columns you need, and use MissingField.UseNull so a missing column becomes an empty column rather than a failure.

Things to watch

In business terms

Mapping an export to a standard layout, such as a journal import template or a standard chart of accounts line, is a classic use. Named columns make the mapping visible to the reviewer.

Related functions

All Power Query M functions · View as Markdown · M basics