Copy ตาราง ด้วย Reference หรือ Duplicate ใน Power Query | Reference vs Duplicate in Power Query: Which Should You Use (TH/EN)

🇹🇭 Copy ตาราง ด้วย Reference หรือ Duplicate ใน Power Query เลือกยังไงไม่ปวดหัวทีหลัง

สรุปจากคลิปของช่อง Lin Davoy คลิปนี้พาไปดูเรื่องพื้นฐานที่คนทำ Power BI และ Excel มือใหม่มักงงตลอด นั่นคือการ Copy ตารางใน Power Query ว่าจะใช้ปุ่ม Reference หรือปุ่ม Duplicate ดี เพราะหน้าตาผลลัพธ์แรกเริ่มดูเหมือนกันมาก แต่พอทำงานจริงไปสักพักความต่างจะเริ่มโผล่มาให้ปวดหัว โดยเฉพาะตอนต้องแก้ไขข้อมูลย้อนหลังหรือไฟล์เริ่มโหลดช้าแบบหาสาเหตุไม่เจอ

Reference กับ Duplicate ต่างกันตรงไหน

ในมุมคนทำงานจริง ทั้งสองปุ่มนี้ทำหน้าที่คล้ายกันคือสร้างตารางใหม่ขึ้นมาจากตารางเดิมโดยไม่ต้องเขียน query ใหม่ตั้งแต่ต้น แต่วิธีทำงานเบื้องหลังต่างกันโดยสิ้นเชิง Duplicate คือการคัดลอกทุกขั้นตอน (Applied Steps) ของตารางต้นฉบับมาไว้ในตารางใหม่ทั้งหมด ตารางใหม่จึงแยกอิสระจากตารางเดิมโดยสมบูรณ์ ถ้าไปแก้ไขขั้นตอนใดในตารางต้นฉบับภายหลัง ตารางที่ Duplicate ไว้จะไม่ได้รับผลกระทบใด ๆ เลย ส่วน Reference คือการสร้างตารางใหม่ที่ชี้กลับไปหาผลลัพธ์สุดท้ายของตารางต้นฉบับ โดยไม่คัดลอกขั้นตอนมาเลยสักบรรทัดเดียว ตารางที่ Reference จึงเหมือนต่อท่อจากตารางต้นฉบับ ถ้าตารางต้นฉบับถูกแก้ไข ตารางที่ Reference ไว้ก็จะเปลี่ยนตามไปด้วยทันทีตอน Refresh

เมื่อไหร่ควรใช้ Reference

Reference เหมาะกับสถานการณ์ที่ต้องการเอาผลลัพธ์ตารางเดียวไปแตกใช้งานหลายทาง เช่น มีตาราง Sales ที่ Clean ข้อมูลเสร็จแล้วหนึ่งตาราง แล้วอยากเอาไปทำสรุปแยกเป็นรายเดือน รายสาขา หรือทำเป็น Dimension table สำหรับ Relationship ในโมเดล การ Reference จะช่วยให้ไม่ต้องเขียนขั้นตอน Clean ซ้ำหลายรอบ แก้ที่ตารางต้นฉบับทีเดียว ตารางลูกทุกตัวที่ Reference ไว้ก็อัปเดตตามพร้อมกันหมด ประหยัดเวลาและลดโอกาสพิมพ์สูตรผิดซ้ำ ๆ ได้มาก

เมื่อไหร่ควรใช้ Duplicate

Duplicate เหมาะกับตอนที่ต้องการทดลองปรับขั้นตอนแบบที่ไม่อยากให้กระทบตารางเดิมเลย เช่น อยากลองเปลี่ยนวิธี Clean ข้อมูลแบบใหม่ แต่ยังไม่แน่ใจว่าจะใช้ได้จริงไหม การ Duplicate จะช่วยให้มีตารางสำรองไว้ทดลองแยกกันชัดเจน ถ้าพังก็ลบตารางที่ Duplicate ทิ้งได้เลยโดยไม่กระทบของเดิม หรือกรณีที่ต้องส่งไฟล์ให้คนอื่นแล้วต้องการให้ทุกตารางแยกอิสระจากกัน ไม่มีการอ้างอิงไขว้กันจนตามแก้ยาก ก็เหมาะกับ Duplicate เช่นกัน

หัวข้อ / AspectReferenceDuplicate
การคัดลอกขั้นตอน / Steps copiedไม่คัดลอก ชี้กลับไปตารางต้นฉบับ / Points back, copies nothingคัดลอกทุกขั้นตอนมาทั้งหมด / Copies every step
ผลเมื่อแก้ตารางต้นฉบับ / Effect of editing sourceเปลี่ยนตามทันทีตอน Refresh / Cascades on refreshไม่ได้รับผลกระทบ / No effect
ความเป็นอิสระ / Independenceผูกกับต้นฉบับตลอด / Always tied to sourceแยกอิสระสมบูรณ์ / Fully independent
เหมาะกับ / Best forแตกตารางสรุปหลายทาง / One source, many outputsทดลองแก้ไขแบบไม่กระทบของเดิม / Safe experiments
ผลต่อ Performanceสายอ้างอิงยาวอาจทำ Refresh ช้า / Long chains can slow refreshแต่ละตารางแยกกัน จัดการง่ายกว่าในบางกรณี / Runs standalone

ข้อควรระวังที่มือใหม่มักพลาด

กับดักที่พบบ่อยที่สุดคือการ Reference ตารางต่อกันเป็นทอด ๆ หลายชั้นจนลืมไปว่าตารางไหนอ้างอิงตารางไหน พอไฟล์โตขึ้นเรื่อย ๆ การ Refresh จะเริ่มช้าลงอย่างเห็นได้ชัด เพราะทุกครั้งที่ Refresh ตารางปลายทาง Power Query ต้องไล่คำนวณย้อนกลับไปทุกตารางในสายที่ Reference มา อีกจุดที่ต้องระวังคือถ้าใช้ Duplicate ไปเรื่อย ๆ โดยไม่มีระบบตั้งชื่อที่ชัดเจน ไฟล์จะเต็มไปด้วยตารางหน้าตาคล้ายกันจนสับสนว่าตัวไหนคือตัวจริงที่ใช้งานอยู่ ดังนั้นไม่ว่าจะเลือกวิธีไหนก็ควรตั้งชื่อตารางให้สื่อความหมายและวางแผนโครงสร้าง query ตั้งแต่ต้น

สรุป

ถ้าจำหลักง่าย ๆ ไว้ข้อเดียวคือ Reference สำหรับงานที่อยากให้เปลี่ยนพร้อมกันเป็นสายเดียว ส่วน Duplicate สำหรับงานที่อยากแยกอิสระจากกันเด็ดขาด เลือกให้ถูกตั้งแต่ต้นจะช่วยให้ไฟล์ Power BI หรือ Excel ของเรา Refresh เร็วขึ้น ดูแลง่ายขึ้น และไม่ต้องมานั่งงงทีหลังว่าทำไมแก้ตารางหนึ่งแล้วอีกตารางถึงเปลี่ยนตามหรือไม่เปลี่ยนตาม


🇬🇧 Reference vs Duplicate in Power Query: Which Copy Method Should You Use

This article is summarized from the Lin Davoy channel. The video covers a basic but often confusing topic for Power BI and Excel beginners: choosing between the Reference button and the Duplicate button when copying a table in Power Query. Both look almost identical at first, but the difference shows up later, especially when editing historical data or when a file suddenly starts loading slowly for no obvious reason.

What Actually Differs Between Reference and Duplicate

From a practitioner point of view, both buttons create a new table from an existing one without writing a new query from scratch, but the underlying mechanics are completely different. Duplicate copies every applied step from the source table into the new table, so the new table becomes fully independent. Later edits to the source table have zero effect on the duplicated one. Reference instead creates a new table that points back to the final output of the source table, without copying a single step. A referenced table behaves like a pipe connected to the source, so any edit to the source table flows through to the referenced table automatically on the next refresh.

When to Use Reference

Reference fits situations where one cleaned result needs to feed several downstream uses, for example a cleaned Sales table that then gets summarized by month, by branch, or turned into a dimension table for a relationship. Reference means the cleaning logic only needs to be written once. Fix the source table, and every table that references it updates automatically, saving time and cutting down on repeated formula mistakes.

When to Use Duplicate

Duplicate is the right call when experimenting with a new cleaning approach without touching the original table at all. If the experiment fails, simply delete the duplicated table and the original stays untouched. It is also the safer choice when sharing a file with someone else and wanting every table to stand on its own, with no cross references that make troubleshooting harder later.

หัวข้อ / AspectReferenceDuplicate
การคัดลอกขั้นตอน / Steps copiedไม่คัดลอก ชี้กลับไปตารางต้นฉบับ / Points back, copies nothingคัดลอกทุกขั้นตอนมาทั้งหมด / Copies every step
ผลเมื่อแก้ตารางต้นฉบับ / Effect of editing sourceเปลี่ยนตามทันทีตอน Refresh / Cascades on refreshไม่ได้รับผลกระทบ / No effect
ความเป็นอิสระ / Independenceผูกกับต้นฉบับตลอด / Always tied to sourceแยกอิสระสมบูรณ์ / Fully independent
เหมาะกับ / Best forแตกตารางสรุปหลายทาง / One source, many outputsทดลองแก้ไขแบบไม่กระทบของเดิม / Safe experiments
ผลต่อ Performanceสายอ้างอิงยาวอาจทำ Refresh ช้า / Long chains can slow refreshแต่ละตารางแยกกัน จัดการง่ายกว่าในบางกรณี / Runs standalone

Common Mistakes Beginners Make

The most common trap is chaining Reference tables several layers deep and losing track of what depends on what. As the file grows, refresh time gets noticeably slower, because every refresh has to recalculate the entire chain behind the final table. The opposite trap comes from overusing Duplicate without a clear naming system, leaving a file full of near identical tables and no clear sense of which one is actually in use. Whichever method gets picked, name tables clearly and plan the query structure early.

Verdict

The simple rule to remember is Reference when changes should cascade through a single chain, and Duplicate when tables need to stay completely independent. Choosing correctly from the start keeps a Power BI or Excel file refreshing faster, easier to maintain, and free of the later confusion over why editing one table did or did not change another.


ติดตามข่าวสาร Data & AI ได้ที่:
Facebook: https://www.facebook.com/davoytech
YouTube: https://www.youtube.com/@linlinmhee

📌 อย่าลืมกด Like, Share และ Subscribe เป็นกำลังใจให้ด้วยนะคะ!

💬 ปกติเพื่อน ๆ ใช้ Reference หรือ Duplicate บ่อยกว่ากันคะ มาคอมเมนต์เล่าเคสที่เจอกันได้เลยค่ะ

#Davoy #DavoyTech #Linlinmhee #เรียนAI #คอร์สAI #DataAndAI #PowerBI #PowerQuery #Excel #DataAnalytics #ExcelTips

Chat Widget - Davoy.tech