Downloads
Power Query MRecordIntermediate

Record.AddField

Returns a copy of a record with one new field added.

Syntax
Record.AddField(record, fieldName, value, optional delayed)

Returns: A new record with the extra field.

What it does

Record.AddField returns a copy of a record with one more field. The original record is not changed. Use it to attach a label or a calculated value to a row, such as a source file name, an entity code or a computed total, before the row goes into a list or a table.

Syntax and arguments

Example

A bank statement has been read into a record for each month, and the team wants each record to carry the entity it belongs to, so the rows can be combined later.

let
    MonthRecord = [Period = "2026-03", Closing = 15940],
    Tagged = Record.AddField(MonthRecord, "Entity", "Northwind US"),
    Fields = Record.FieldNames(Tagged)
in
    Tagged

Tagged is the record with three fields: Period, Closing and Entity. The original MonthRecord still has only two.

Example: a second, different use

Adding a calculated field to a row: Record.AddField(Row, "Variance", Row[Actual] - Row[Budget]) gives the row a variance field.

Things to watch

In business terms

Tagging rows with entity, source or period before combining files lets the reviewer trace every line back to its file. A tag is cheap to add and very useful when a total does not agree.

Related functions

All Power Query M functions · View as Markdown · M basics