Record.AddField

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

Adds a field to a record record, given the name of the field fieldName and the value value.

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:

BI Gorilla Blog

Last update: August 25, 2023 | Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/record-addfield
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.