Thep Excel

Record.AddField – Add a field to a Power Query record

Adds a new field with a specified name and value to a record | เพิ่มฟิลด์ใหม่พร้อมชื่อและค่าเข้าไปใน Record

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

By ThepExcel AI Agent
4 December 2025

Function Metrics


Popularity
5/10

Difficulty
4/10

Usefulness
5/10

Syntax & Arguments

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

Argument Type Required Default Description
record record Yes The record object to be modified
fieldName text Yes The name of the new field being added
value any Yes The data value to assign to the field
delayed nullable logical Optional false Optional parameter; allows deferred evaluation when set to true

Examples

Add a single field to a customer record
Record.AddField([CustomerID = 1, Name = "Bob", Phone = "123-4567"], "Address", "123 Main St.")
Adds an Address field to an existing customer record while preserving all original fields
Power Query Formula:

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

Result:

[CustomerID = 1, Name = "Bob", Phone = "123-4567", Address = "123 Main St."]

Add multiple fields using nested Record.AddField
let Customer = [ID = 1, Name = "Alice"], WithEmail = Record.AddField(Customer, "Email", "alice@example.com"), WithCity = Record.AddField(WithEmail, "City", "New…
Chain multiple Record.AddField calls to progressively add new fields to a record
Power Query Formula:

let
    Customer = [ID = 1, Name = "Alice"],
    WithEmail = Record.AddField(Customer, "Email", "alice@example.com"),
    WithCity = Record.AddField(WithEmail, "City", "New York")
in
    WithCity

Result:

[ID = 1, Name = "Alice", Email = "alice@example.com", City = "New York"]

Add a calculated field value
let Item = [Price = 100, Quantity = 5], Total = Item[Price] * Item[Quantity], WithTotal = Record.AddField(Item, "Total", Total) in WithTotal
Add a field with a calculated value based on existing fields in the record
Power Query Formula:

let
    Item = [Price = 100, Quantity = 5],
    Total = Item[Price] * Item[Quantity],
    WithTotal = Record.AddField(Item, "Total", Total)
in
    WithTotal

Result:

[Price = 100, Quantity = 5, Total = 500]

Resources & Related

Additional Notes

Record.AddField adds a new field to an existing Power Query record with a specified name and value. This function is essential for dynamically extending records during data transformation workflows.

ฟังก์ชัน Record.AddField ใช้สำหรับเพิ่มฟิลด์ใหม่เข้าไปใน Record ที่มีอยู่แล้ว โดยระบุชื่อฟิลด์และค่าที่ต้องการเพิ่ม เหมาะสำหรับการขยายโครงสร้างข้อมูลแบบไดนามิกในกระบวนการแปลงข้อมูล

Leave a Reply

Your email address will not be published. Required fields are marked *