Record.AddField Function in Power Query

The Record.AddField function adds a field in the given record. The field name and its value are given in the function itself.

Syntax

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

Example: Add the Salary field to the record.

Power Query M

let
    Source = Record.AddField([CustomerID = 1, Name = "Ashish", Phone = "123-4567", Company = "TCS"], "Salary",70000)
in
    Source      

The output of the above code is shown below:

Record.AddField function in Power Query