---
title: Table.FuzzyJoin – เชื่อมตารางโดยใช้การเปรียบเทียบแบบ Fuzzy (คล้ายกัน)
url: https://www.thepexcel.com/functions/power-query/table-functions/table-fuzzyjoin/
type: function-explainer
program: Power Query
syntax: "Table.FuzzyJoin(table1 as table, key1 as any, table2 as table, key2 as any, optional joinKind as nullable number, optional joinOptions as nullable record) as table"
date: 2025-12-15
updated: 2025-12-23
scores:
  popularity: 4
  difficulty: 7
  usefulness: 6
---

# Table.FuzzyJoin – เชื่อมตารางโดยใช้การเปรียบเทียบแบบ Fuzzy (คล้ายกัน)

> Table.FuzzyJoin ใช้สำหรับเชื่อม 2 ตารางเข้าด้วยกันโดยใช้คีย์ที่มีความคล้ายคลึงกัน (Fuzzy Matching) แ

## คำอธิบาย

Table.FuzzyJoin ใช้สำหรับเชื่อม 2 ตารางเข้าด้วยกันโดยใช้คีย์ที่มีความคล้ายคลึงกัน (Fuzzy Matching) แทนที่จะต้องเหมือนกันทุกตัวอักษร สามารถกำหนดระดับความเหมือน (Threshold) และตัวเลือกอื่นๆ ได้

## Syntax

```excel
Table.FuzzyJoin(table1 as table, key1 as any, table2 as table, key2 as any, optional joinKind as nullable number, optional joinOptions as nullable record) as table
```

## Arguments

| Name | Required | Type | Default | Description |
| --- | --- | --- | --- | --- |
| table1 | Yes | table |  | ตารางแรก (ซ้าย) ที่จะเชื่อม |
| key1 | Yes | any |  | ชื่อคอลัมน์ที่ใช้เชื่อมจากตารางแรก สามารถเป็นข้อความเดียว ("ColName") หรือลิสต์ ({"Col1", "Col2"}) |
| table2 | Yes | table |  | ตารางที่สอง (ขวา) ที่จะเชื่อม |
| key2 | Yes | any |  | ชื่อคอลัมน์ที่ใช้เชื่อมจากตารางที่สอง ต้องมีจำนวนเท่ากับ key1 |
| joinKind | No | nullable number | JoinKind.Inner | ประเภท Join: JoinKind.Inner, JoinKind.LeftOuter, JoinKind.RightOuter, JoinKind.FullOuter, JoinKind.LeftAnti, JoinKind.RightAnti, JoinKind.LeftSemi, JoinKind.RightSemi |
| joinOptions | No | nullable record | null (ค่า Default: Threshold=0.80, IgnoreCase=true, IgnoreSpace=true) | ตัวเลือก Fuzzy Matching ใน Record เช่น [IgnoreCase=true, IgnoreSpace=true, Threshold=0.8, SimilarityColumnName="Score"] |

## เคสการใช้งาน

### Map ข้อมูลระหว่างระบบที่ใช้มาตรฐานการตั้งชื่อต่างกัน

ใช้เชื่อมข้อมูลสินค้าหรือลูกค้าที่ชื่อสะกดไม่เหมือนกันเป๊ะๆ ระหว่างสองระบบ

### แก้ปัญหา Typos ในการ Join ข้อมูล

ช่วยให้การ Join ไม่ล้มเหลวเพียงเพราะมีตัวอักษรผิดพลาดเล็กน้อย

## ตัวอย่าง

### 1. ตัวอย่างที่ 1: Join โดยไม่สนตัวพิมพ์เล็กใหญ่

```excel
let
    Customers = Table.FromRecords({
        [ID = 1, City = "Bangkok"],
        [ID = 2, City = "Chiang Mai"],
        [ID = 3, City = "Phuket"]
    }),
    CityData = Table.FromRecords({
        [CityName = "bangkok", Region = "Central"],
        [CityName = "chiang mai", Region = "North"],
        [CityName = "phuket", Region = "South"]
    }),
    Joined = Table.FuzzyJoin(
        Customers, "City",
        CityData, "CityName",
        JoinKind.LeftOuter,
        [IgnoreCase = true]
    )
in
    Joined
```

**ผลลัพธ์:** `ตารางผลลัพธ์ 3 แถว: ID, City, CityName, Region - Bangkok, Chiang Mai, Phuket จับคู่ได้สำเร็จแม้ว่า case ต่างกัน`

ใช้ IgnoreCase=true เพื่อให้ 'Bangkok' จับคู่กับ 'bangkok' ได้ ส่วน LeftOuter ให้แถวจาก Customers ทั้งหมดแม้ไม่จับคู่

### 2. ตัวอย่างที่ 2: กำหนดค่า Threshold สำหรับตัวสะกดผิด

```excel
let
    Products = Table.FromRecords({
        [ProdID = 1, Product = "Microsoft Office"],
        [ProdID = 2, Product = "Google Workspace"],
        [ProdID = 3, Product = "Adobe Creative Cloud"]
    }),
    Inventory = Table.FromRecords({
        [ItemName = "Micro soft Office", Stock = 150],
        [ItemName = "Googl Workspace", Stock = 200],
        [ItemName = "Adobe Creative Cloud", Stock = 50]
    }),
    Joined = Table.FuzzyJoin(
        Products, "Product",
        Inventory, "ItemName",
        JoinKind.LeftOuter,
        [Threshold = 0.75, IgnoreSpace = true]
    )
in
    Joined
```

**ผลลัพธ์:** `ตารางผลลัพธ์: 'Microsoft Office' เข้ากับ 'Micro soft Office' แม้มีช่องว่างพิเศษ, 'Google Workspace' เข้ากับ 'Googl Workspace'`

Threshold=0.75 ยอมรับความเหมือนที่ 75% ขึ้นไป พอสำหรับจับการสะกดผิดเล็กน้อย IgnoreSpace=true ทำให้ 'Micro soft' ถูกมองเสมือน 'Microsoft'

### 3. ตัวอย่างที่ 3: แสดงค่า Similarity Score

```excel
let
    Customers = Table.FromRecords({
        [CustName = "John Smith"],
        [CustName = "Jane Doe"],
        [CustName = "Bob Wilson"]
    }),
    Orders = Table.FromRecords({
        [BuyerName = "Jon Smith", OrderID = "O1"],
        [BuyerName = "Jane Do", OrderID = "O2"],
        [BuyerName = "Robert Wilson", OrderID = "O3"]
    }),
    Joined = Table.FuzzyJoin(
        Customers, "CustName",
        Orders, "BuyerName",
        JoinKind.LeftOuter,
        [Threshold = 0.70, SimilarityColumnName = "MatchScore"]
    )
in
    Joined
```

**ผลลัพธ์:** `ตารางผลลัพธ์ มีคอลัมน์ MatchScore แสดงว่า 'John Smith' เข้ากับ 'Jon Smith' ได้ 90%, 'Jane Doe' เข้า 'Jane Do' ได้ 80% เป็นต้น`

SimilarityColumnName ใช้เพื่อเพิ่มคอลัมน์ที่แสดงคะแนนความเหมือนจริงๆ ช่วยให้ตรวจสอบการจับคู่ได้

### 4. ตัวอย่างที่ 4: Join หลายคอลัมน์

```excel
let
    Table1 = Table.FromRecords({
        [FirstName = "John", LastName = "Smith", ID = 1],
        [FirstName = "Jane", LastName = "Doe", ID = 2]
    }),
    Table2 = Table.FromRecords({
        [FName = "jon", LName = "smith", Phone = "555-1234"],
        [FName = "jane", LName = "do", Phone = "555-5678"]
    }),
    Joined = Table.FuzzyJoin(
        Table1, {"FirstName", "LastName"},
        Table2, {"FName", "LName"},
        JoinKind.LeftOuter,
        [IgnoreCase = true, Threshold = 0.80]
    )
in
    Joined
```

**ผลลัพธ์:** `ตารางผลลัพธ์: แถว 1 เข้าคู่ (FirstName='John' เข้า FName='jon', LastName='Smith' เข้า LName='smith'), แถว 2 อาจไม่เข้าคู่ถ้า 'Doe' ไม่เหมือน 'do' มากพอ`

เมื่อใช้ลิสต์หลายคอลัมน์ {"FirstName", "LastName"} ต้องจับคู่ทั้งคู่ถึงถือว่าเป็นการ Match

## หมายเหตุเพิ่มเติม

- ใช้ SimilarityColumnName ถ้าต้องการตรวจสอบคุณภาพของการจับคู่ จากนั้นกรองแถวที่ Match score ต่ำ

- Performance: Fuzzy Matching ช้ากว่า Exact Match มาก ถ้าข้อมูลหลักพันแถว พิจารณาใช้ ConcurrentRequests=4-8

- หากเชื่อม 2 ตารางที่ใหญ่ (>100K แถว) Fuzzy Join อาจ Hang ให้ลองลดข้อมูลก่อน (Filter or Group) แล้วค่อย Join

- ใช้ Table.Distinct บน key column ก่อน Fuzzy Join ถ้าต้องการหลีกเลี่ยงแถว Duplicate ที่มีหลาย Match

- ถ้าต้องการแสดงที่จับคู่ได้กับที่จับคู่ไม่ได้ ใช้ JoinKind.LeftOuter เพื่อรักษาแถวจาก table1 ทั้งหมด

## คำถามที่พบบ่อย

**Q: Threshold ควรตั้งค่าเท่าไหร่?**

ขึ้นอยู่กับกรณีการใช้งาน: 0.90 ขึ้นไป = แม่นยำสูง ยอมรับเฉพาะการสะกดผิดเล็กน้อย | 0.80 = ค่า Default ที่สมดุล | 0.70 = ยืดหยุ่นมากขึ้น ยอมรับการสะกดผิดระดับกลาง | ต่ำกว่า 0.70 = ระวัง อาจจับคู่ผิด เช่น 'John' เข้ากับ 'Joan'

**Q: ต่างกันอะไร Table.FuzzyJoin กับ Table.Join?**

Table.Join ต้องการความเหมือนแบบ Exact (ตรงกันทุกตัว) ส่วน Table.FuzzyJoin ยอมรับความเหมือนแบบ Approximate (คล้ายๆกัน) ถ้าข้อมูลสะอาด Table.Join จะเร็วกว่า แต่ถ้ามีการสะกดผิดจำเป็นต้อง FuzzyJoin

**Q: SimilarityColumnName ใช้ทำไม?**

เพิ่มคอลัมน์ใหม่ที่แสดงคะแนนความเหมือนจริงๆ (0.00-1.00) ช่วยให้ตรวจสอบว่า Match นั้นเชื่อถือได้แค่ไหน เช่น Match ที่ 0.95 น่าเชื่อ แต่ 0.71 ต้องสังสัย

**Q: IgnoreSpace=true ทำอะไร?**

รวมข้อความที่มีช่องว่างเกิน เช่น 'Micro soft' ถูกมองเป็น 'Microsoft' ใช้ได้ดีกับชื่อ ที่บางคนพิมพ์มีช่องว่างตรงกลาง แต่ต้องระวังกับสถานการณ์ที่ต้องรักษาช่องว่างไว้

**Q: ConcurrentRequests=4 มีประโยชน์ไหม?**

ใช่ เพิ่ม ConcurrentRequests ให้สูงขึ้น (1-8) ทำให้การจับคู่ Fuzzy เร็วขึ้น โดยใช้หลาย thread พร้อมๆกัน เช่น ConcurrentRequests=4 จะเร็วขึ้นประมาณ 3 เท่า แต่ใช้ทรัพยากร CPU มากขึ้น

**Q: NumberOfMatches=2 คืออะไร?**

จำนวนแถวจาก table2 ที่จะจับคู่กับแถวเดียวจาก table1 ค่า Default คือ 1 (จับ 1 แถวต่อ 1 แถว) ถ้า=2 ได้ 2 แถวต่อ 1 แถว ก็จะเพิ่มแถวผลลัพธ์ไป

**Q: Culture parameter ใช้ทำไม?**

ระบุกฎการจับคู่ของภาษา เช่น Culture="ja-JP" สำหรับญี่ปุ่น, "th-TH" สำหรับไทย บางภาษามีกฎการเปรียบเทียบพิเศษ เช่น ตัวอักษรลากหาง ในไทย

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

- [Microsoft Learn: Table.FuzzyJoin](https://learn.microsoft.com/en-us/powerquery-m/table-fuzzyjoin) _(official)_
- [Microsoft Learn: Table.Join](https://learn.microsoft.com/en-us/powerquery-m/table-join) _(official)_

---

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