Record.FromList

The function retrieves a data record based on a specified list of field values and a set of fields. Fields can be identified using either a list of text values or a record type. An error will be gener...

Syntax

Record.FromList(list as list, fields as any) as record

About

The function retrieves a data record based on a specified list of field values and a set of fields. Fields can be identified using either a list of text values or a record type. An error will be generated if the specified fields are not distinct.

Explanation

Create a data record using a list of field values and a list of field names. To do this in Power Query M, use the MRecord.FromList function with the following syntax: MRecord.FromList({1, "Bob", "123-4567"}, {"CustomerID", "Name", "Phone"}) The output will be: [CustomerID = 1, Name = "Bob", Phone = "123-4567"] Create a data record using a list of field values and a record type. To accomplish this in Power Query M, use the MRecord.FromList function with the following syntax: MRecord.FromList({1, "Bob", "123-4567"}, type [CustomerID = number, Name = text, Phone = number]) The output will be: [CustomerID = 1, Name = "Bob", Phone = "123-4567"]