INTERSECT คืนตารางของแถวที่อยู่ในทั้ง LeftTable และ RightTable เหมาะกับการหาส่วนร่วมของชุดข้อมูลสองชุด
=INTERSECT(<LeftTable>, <RightTable>)
=INTERSECT(<LeftTable>, <RightTable>)
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
| LeftTable | table | Yes | ตารางฝั่งซ้าย | |
| RightTable | table | Yes | ตารางฝั่งขวา |
เช่น เทียบ ProductID จากสองตาราง
เช่น ลูกค้าที่อยู่ในทั้งแคมเปญ A และ B
Products Sold and Returned = INTERSECT( VALUES(Sales[ProductID]), VALUES(Returns[ProductID]) )Products Sold and Returned =
INTERSECT(
VALUES(Sales[ProductID]),
VALUES(Returns[ProductID])
)
ได้รายการ ProductID ที่อยู่ในทั้งสองตาราง
Customers in Both = INTERSECT( VALUES(ProgramA[CustomerID]), VALUES(ProgramB[CustomerID]) )Customers in Both =
INTERSECT(
VALUES(ProgramA[CustomerID]),
VALUES(ProgramB[CustomerID])
)
ได้รายชื่อ CustomerID ที่อยู่ในทั้ง A และ B
Only in A = EXCEPT( VALUES(ProgramA[CustomerID]), VALUES(ProgramB[CustomerID]) )Only in A =
EXCEPT(
VALUES(ProgramA[CustomerID]),
VALUES(ProgramB[CustomerID])
)
ได้ลูกค้าที่อยู่ใน A แต่ไม่อยู่ใน B
INTERSECT คืนเฉพาะส่วนที่อยู่ในทั้งสองชุด ส่วน UNION รวมทุกแถวจากทุกชุดเข้าด้วยกัน
ควรมีคอลัมน์ที่สอดคล้องกัน เพื่อให้การเทียบแถวทำงานได้ถูกต้อง
INTERSECT ใช้คืนตารางของแถวที่อยู่ในทั้ง LeftTable และ RightTable (แนวคิดเหมือนส่วนร่วมของเซต) เหมาะกับการหาสิ่งที่ “ซ้ำกัน/ร่วมกัน” เช่น ลูกค้าที่อยู่ในทั้งสองโปรแกรม หรือสินค้าที่ปรากฏในทั้งยอดขายและคืนสินค้า