Table.RemoveRows ใช้สำหรับลบแถวออกจากตาราง โดยระบุตำแหน่งเริ่มต้นและจำนวนแถวที่ต้องการลบ
=Table.RemoveRows(table as table, offset as number, optional count as nullable number) as table
=Table.RemoveRows(table as table, offset as number, optional count as nullable number) as table
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
| table | table | Yes | ตารางที่ต้องการลบแถว | |
| offset | number | Yes | ตำแหน่งแถวแรกที่จะลบ (เริ่มนับจาก 0) | |
| count | number | Optional | 1 | จำนวนแถวที่ต้องการลบ (ค่าเริ่มต้นคือ 1) |
ลบข้อมูลส่วนหัวหรือส่วนท้ายที่ไม่ต้องการแบบระบุตำแหน่งได้
ลบข้อมูลช่วงกลางของตารางที่ทราบตำแหน่งแน่นอน
จัดการตารางที่มีรูปแบบคงที่
let Source = Table.FromRecords({[A=1], [A=2], [A=3]}), Removed = Table.RemoveRows(Source, 0, 1) in Removedlet
Source = Table.FromRecords({[A=1], [A=2], [A=3]}),
Removed = Table.RemoveRows(Source, 0, 1)
in
Removed
Table with row 2 and 3
let Source = Table.FromRecords({[A=1], [A=2], [A=3], [A=4]}), Removed = Table.RemoveRows(Source, 1, 2) in Removedlet
Source = Table.FromRecords({[A=1], [A=2], [A=3], [A=4]}),
Removed = Table.RemoveRows(Source, 1, 2)
in
Removed
Table with row 1 and 4
let Source = Table.FromRecords({[ID=1], [ID=2], [ID=3], [ID=4], [ID=5]}), // ลบ 3 แถว เริ่มจาก index 2 (คือแถวที่ 3, 4, 5) Removed = Table.RemoveRows(Source, 2,…let
Source = Table.FromRecords({[ID=1], [ID=2], [ID=3], [ID=4], [ID=5]}),
// ลบ 3 แถว เริ่มจาก index 2 (คือแถวที่ 3, 4, 5)
Removed = Table.RemoveRows(Source, 2, 3)
in
Removed
Table with ID 1 and 2
Table.RemoveRows ใช้สำหรับลบแถวออกจากตาราง โดยระบุตำแหน่งเริ่มต้น (Offset) และจำนวนแถว (Count) ที่ต้องการลบ ซึ่งมีประโยชน์ในการลบข้อมูลช่วงกลางหรือส่วนที่ไม่ต้องการออกเมื่อทราบตำแหน่งที่แน่นอน