Thep Excel

69 functions

Table.Skip คืนตารางที่ลบแถวแรกๆ ออกไปแล้ว โดยสามารถระบุจำนวนแถวที่ต้องการข้าม หรือระบุเงื่อนไข (condition function) เพื่อข้ามแถวที่ตรงเงื่อนไขจนกว่าจะพบแถวที่ไม่ตรงแล้วหยุด ถ้าไม่ระบุจะข้ามแถวแรก 1 แถว ถ้าส่งเป็นตัวเลข เช่น 5 จะข้าม 5 แถวแรก ถ้าส่งเป็นฟังก์ชัน เช่น each [Amount] > 0 จะข้ามแถวที่ Amount > 0 จนกว่าจะเจอแถวที่ Amount ≤ 0

Syntax
Table.Skip(table as table, optional countOrCondition as any) as table

แบ่งตารางออกเป็นรายการของตารางย่อยตามจำนวนแถวที่กำหนด เหมาะสำหรับ Pagination และ Batch Processing

Syntax
Table.Split(table as table, pageSize as number) as list

Table.StopFolding ป้องกันไม่ให้ขั้นตอน downstream ถูกส่งกลับไปประมวลผลที่ data source เดิม ช่วยเมื่อต้องดีบักหรือเมื่อการบังคับประมวลผลใน Power Query ให้ผลลัพธ์ที่คาดหวัง

Syntax
= Table.StopFolding(table)

Table.ToColumns แปลงตาราง (Table) ให้เป็น List ของ List โดยแต่ละ List ย่อยแทนข้อมูลจากคอลัมน์เดียว เรียงตามลำดับคอลัมน์จากซ้ายไปขวา ส่วนกลับกันของ Table.FromColumns

Syntax
= Table.ToColumns(table as table) as list

Table.ToRows แปลงตารางให้เป็น List ของ List โดยแต่ละ List ย่อยแทนข้อมูล 1 แถว ไม่มีชื่อคอลัมน์ เหมาะสำหรับส่งออกข้อมูลเป็น JSON/CSV หรือประมวลผลแถวโดยไม่สนใจชื่อฟิลด์

Syntax
Table.ToRows(table as table) as list

Table.TransformColumnNames ใช้ฟังก์ชันแปลงชื่อ (Name Generator) เพื่อเปลี่ยนชื่อคอลัมน์ทั้งหมดในตาราง เหมาะสำหรับจัดรูปแบบชื่อคอลัมน์เป็นแบบเดียวกัน เช่น ตัวพิมพ์ใหญ่ ลบช่องว่าง หรือเพิ่ม Prefix

Syntax
Table.TransformColumnNames(table as table, nameGenerator as function, optional options as nullable record) as table

Table.TransformColumns ใช้สำหรับแปลงข้อมูลในคอลัมน์โดยใช้ฟังก์ชันที่กำหนดไว้ แต่ละคอลัมน์สามารถมีการแปลงแตกต่างกันได้ รองรับการเปลี่ยนแปลงประเภทข้อมูลในเวลาเดียวกัน

Syntax
Table.TransformColumns(table, transformOperations, [defaultTransformation], [missingField])

Table.TransformColumnTypes เปลี่ยน Data Type ของคอลัมน์ที่ระบุให้เป็นประเภทใหม่ (เช่น Text เป็น Number, Date เป็น Text) โดยใช้ built-in conversion methods เบื้องหลัง รองรับการแปลงหลายคอลัมน์พร้อมกัน และสามารถระบุ culture parameter เพื่อจัดการ locale-specific formatting สำหรับวันที่และตัวเลข เหมาะสำหรับขั้นตอนเตรียมข้อมูลก่อน Load เข้า Data Model เพื่อป้องกัน conversion errors และเพิ่มประสิทธิภาพ ใช้ร่วมกับ Table.TransformColumns, Number.From, Text.From และ Date.From เมื่อต้องการ custom transformation logic

Syntax
Table.TransformColumnTypes(table as table, typeTransformations as list, optional culture as nullable text) as table

Table.Transpose จะกลับด้านตาราง คล้ายกับการ Copy > Paste Special > Transpose ใน Excel โดยข้อมูลในแถวที่ 1 จะกลายเป็นคอลัมน์ที่ 1 แถวที่ 2 เป็นคอลัมน์ที่ 2 ไปเรื่อยๆ

Syntax
Table.Transpose(table as table, optional columns as any) as table

Table.Unpivot แปลงคอลัมน์ที่ระบุให้กลายเป็นแถว (Unpivot) โดยสร้าง 2 คอลัมน์ใหม่ คอลัมน์แรกเก็บชื่อคอลัมน์เดิม (Attribute) และคอลัมน์ที่สองเก็บค่า (Value) ฟังก์ชันนี้จะข้ามค่า null โดยอัตโนมัติ เหมาะสำหรับเตรียมข้อมูลแบบ Wide Format ให้กลายเป็น Long Format สำหรับใช้ใน Power BI หรือ Pivot Table

Syntax
Table.Unpivot(table as table, pivotColumns as list, attributeColumn as text, valueColumn as text) as table

Table.UnpivotOtherColumns แปลงคอลัมน์ที่ไม่ได้ระบุทั้งหมดให้กลายเป็นแถว (Unpivot) โดยระบุเฉพาะคอลัมน์ที่ต้องการคงไว้ ข้อดีคือเป็น Dynamic ถ้ามีคอลัมน์ใหม่เพิ่มเข้ามาในอนาคตก็จะถูก Unpivot ให้อัตโนมัติ เหมาะสำหรับแปลงข้อมูลจาก Wide Format (หลายคอลัมน์) ให้เป็น Long Format (หลายแถว) สำหรับ PivotTable และ Database

Syntax
Table.UnpivotOtherColumns(table as table, pivotColumns as list, attributeColumn as text, valueColumn as text) as table

Tables.GetRelationships ดึงข้อมูลความสัมพันธ์ (Relationships) ระหว่างตารางต่างๆ จาก Navigation Table เพื่อวิเคราะห์โครงสร้างข้อมูล

Syntax
Tables.GetRelationships(tables as table, optional dataColumn as nullable text) as table