Record.AddField

Updated on

Record.AddField is a Power Query M function that adds a field to a record, given the name of the field and its value. The function returns a new record with the specified field added to it.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Record.AddField(
   record as record,
   fieldName as text,
   value as any,
   optional delayed as nullable logical,
) as record

Description

Record.AddField integrates a new field into an existing record with a designated fieldName and assigns it a value. This function expands the record by adding an additional piece of data without altering the existing content.

Examples

Add the field Address to the record.

// Output: [CustomerID = 1, Name = "Bob", Phone = "123-4567", Address = "123 Main St."]
Record.AddField( [CustomerID = 1, Name = "Bob", Phone = "123-4567"], "Address", "123 Main St." )

Other functions related to Record.AddField are:

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/record-addfield