Record.SelectFields Function in Power Query

The Record.SelectFields function returns a new record that contains the fields selected from the input record. The original order of the fields is maintained.

Note: To specify the included fields in the returned record, we can specify the column names in list if there are more than one.

Syntax

Record.SelectFields(record as record, fields as any, optional missingField as nullable number) as record

Example: Select the fields “Name” and “Phone” from the record.

Power Query M

let
  source = [CustomerID = 1, Name = "Ashish", Phone = "123-4567"], 
  Return = Record.SelectFields(source, {"Name", "Phone"})
in
  Return         

The output of the above code is shown below:

Record.SelectFields function in Power Query