---
title: Record.AddField – Add a field to a Power Query record
url: https://www.thepexcel.com/functions/power-query/record-functions/record-addfield/
type: function-explainer
program: Power Query
syntax: "Record.AddField(record as record, fieldName as text, value as any, optional delayed as nullable logical) as record"
date: 2025-12-04
updated: 2025-12-17
scores:
  popularity: 5
  difficulty: 4
  usefulness: 5
---

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

> Add a field to a record with a name and value | เพิ่มฟิลด์ใหม่เข้าไปใน Record

## คำอธิบาย

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

## Syntax

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

## Arguments

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

## ตัวอย่าง

### 1. Add a single field to a customer record

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

**ผลลัพธ์:** `[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

### 2. Add multiple fields using nested Record.AddField

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

**ผลลัพธ์:** `[ID = 1, Name = "Alice", Email = "alice@example.com", City = "New York"]`

Chain multiple Record.AddField calls to progressively add new fields to a record

### 3. Add a calculated field value

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

**ผลลัพธ์:** `[Price = 100, Quantity = 5, Total = 500]`

Add a field with a calculated value based on existing fields in the record

## ฟังก์ชันที่เกี่ยวข้อง

- [Record.Field – ดึงค่า Field จาก Record](https://www.thepexcel.com/functions/power-query/record-functions/record-field/)
- [Record.FieldOrDefault – ดึงค่า Record แบบปลอดภัย](https://www.thepexcel.com/functions/power-query/record-functions/record-fieldordefault/)
- [Record.RemoveFields – Remove fields from a record](https://www.thepexcel.com/functions/power-query/record-functions/record-removefields/)
- [Record.SelectFields – เลือก Field ที่ต้องการจาก Record](https://www.thepexcel.com/functions/power-query/record-functions/record-selectfields/)

## แหล่งข้อมูลเพิ่มเติม

- [Microsoft Learn: Record.AddField](https://learn.microsoft.com/en-us/powerquery-m/record-addfield) _(official)_

---

_Source: [https://www.thepexcel.com/functions/power-query/record-functions/record-addfield/](https://www.thepexcel.com/functions/power-query/record-functions/record-addfield/)_
