Thep Excel

COMBINEVALUES – สร้างคีย์รวมด้วยตัวคั่น

COMBINEVALUES รวมหลายค่าสเกลาร์เป็นข้อความเดียว โดยกำหนดตัวคั่นได้ เหมาะกับการสร้างคีย์รวมจากหลายคอลัมน์ในแถวเดียว

=COMBINEVALUES(<delimiter>, <expression1>, <expression2>[, <expression3>...])

By ThepExcel AI Agent
13 December 2025

Function Metrics


Popularity
5/10

Difficulty
3/10

Usefulness
5/10

Syntax & Arguments

=COMBINEVALUES(<delimiter>, <expression1>, <expression2>[, <expression3>...])

Argument Type Required Default Description
delimiter scalar Yes ตัวคั่นระหว่างค่าแต่ละส่วน (เช่น “|”)
expression1 scalar Yes ค่าส่วนที่ 1
expression2 scalar Yes ค่าส่วนที่ 2
expression3 scalar Optional ไม่ระบุ ค่าส่วนเพิ่มเติม (ถ้ามี)

How it works

สร้างคีย์รวมจากหลายคอลัมน์

เช่น รวม CustomerID และ OrderID เป็นคีย์เดียว

สร้าง label แบบหลายส่วน

รวมรหัส/ชื่อ/ปี ให้แสดงในรูปแบบเดียวกัน

Examples

ตัวอย่างที่ 1: สร้างคีย์ Customer|Order
Customer Order Key = COMBINEVALUES( "|", Sales[CustomerID], Sales[OrderID] )
เหมาะเมื่ออยากมีคีย์เดียวที่ระบุเอกลักษณ์จากหลายคอลัมน์ในแถวเดียว
DAX Formula:

Customer Order Key =
COMBINEVALUES(
    "|",
    Sales[CustomerID],
    Sales[OrderID]
)

Result:

ได้สตริงคีย์รวม เช่น 1001|A-000123

ตัวอย่างที่ 2: สร้างคีย์หลายส่วนด้วยตัวคั่น
Composite Key = COMBINEVALUES( "-", Sales[Region], Sales[Store], Sales[InvoiceNo] )
รองรับมากกว่า 2 ค่า ทำให้สร้างคีย์หลายส่วนได้สะดวก
DAX Formula:

Composite Key =
COMBINEVALUES(
    "-",
    Sales[Region],
    Sales[Store],
    Sales[InvoiceNo]
)

Result:

ได้สตริงลักษณะ Region-Store-Invoice

ตัวอย่างที่ 3: สร้าง label ที่อ่านง่าย
Display Label = COMBINEVALUES( " / ", Products[Brand], Products[ProductName] )
ใช้ทำ label สำหรับแสดงผลในภาพรวม/ตารางได้ง่าย
DAX Formula:

Display Label =
COMBINEVALUES(
    " / ",
    Products[Brand],
    Products[ProductName]
)

Result:

ได้สตริง “Brand / ProductName”

FAQs

COMBINEVALUES ต่างจาก CONCATENATE อย่างไร?

CONCATENATE ต่อได้ 2 ค่าและไม่ได้มีแนวคิดเรื่องตัวคั่นเป็นหลัก ส่วน COMBINEVALUES ออกแบบมาสำหรับรวมหลายค่าโดยมี delimiter ชัดเจน เหมาะกับการทำคีย์รวม

ควรเลือก delimiter อะไรดี?

เลือกตัวคั่นที่ไม่ชนกับข้อมูลจริง เช่น “|” หรือ ” / ” เพื่อหลีกเลี่ยงความกำกวมเมื่อแยกส่วนหรืออ่านค่า

Resources & Related

Additional Notes

COMBINEVALUES ใช้รวมหลายค่าให้เป็นสตริงเดียวโดยมีตัวคั่น (delimiter) มักใช้สร้างคีย์รวม (composite key) เช่น CustomerID|OrderID เพื่อช่วยทำงานจำแนก/จับคู่ข้อมูล หรือสร้างคีย์สำหรับการจัดกลุ่มในรายงาน

Leave a Reply

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