Table.RemoveMatchingRows
Menghapus semua kemunculan baris yang ditetapkan dari tabel.
Syntax
Table.RemoveMatchingRows(
table as table,
rows as list,
optional equationCriteria as any
) as table
Remarks
Menghapus semua kemunculan baris yang ditetapkan dari tabel.
table: Tabel yang akan dicari.rows: Daftar berisi informasi tentang baris yang akan dihapus.equationCriteria: (Opsional) Menentukan bagaimana kesetaraan ditentukan saat membandingkan nilai. Parameter ini dapat berupa fungsi pemilih kunci, fungsi pembanding, atau daftar kolom dalam tabel untuk digunakan saat membandingkan baris.
Examples
Example #1
Hapus setiap baris yang memiliki [a = 1] dari tabel yang ditentukan.
Table.RemoveMatchingRows(
Table.FromRecords({
[a = 1, b = 2],
[a = 3, b = 4],
[a = 1, b = 6]
}),
{[a = 1]},
"a"
)
Result:
Table.FromRecords({[a = 3, b = 4]})
Example #2
Hapus pesanan yang dibatalkan, abaikan huruf besar/kecil.
let
CurrentOrders = #table(type table[OrderID = number, Product = text, Quantity = number],
{
{101, "Widget", 5},
{102, "Gadget", 3},
{103, "Widget", 5}
}),
CanceledOrders = {
[OrderID = 103, Product = "widget", Quantity = 5]
},
FilteredOrders = Table.RemoveMatchingRows(CurrentOrders, CanceledOrders, Comparer.OrdinalIgnoreCase)
in
FilteredOrders
Result:
#table(type table[OrderID = number, Product = text, Quantity = number],
{
{101, "Widget", 5},
{102, "Gadget", 3}
})
Example #3
Hapus semua tugas pemeliharaan yang jatuh pada hari libur AS.
let
MaintenanceSchedule = #table(type table [Task = text, Date = date],
{
{"HVAC Check", #date(2025, 7, 10)}, // Not a holiday
{"Window Washing", #date(2025, 9, 1)}, // Labor Day
{"Fire Drill", #date(2025, 9, 17)}, // Not a holiday
{"Light Bulb Replacement", #date(2025, 11, 27)} // Thanksgiving
}),
USHolidays = {
[Date = #date(2025, 1, 1)], // New Year's Day
[Date = #date(2025, 7, 4)], // Independence Day
[Date = #date(2025, 9, 1)], // Labor Day
[Date = #date(2025, 11, 27)], // Thanksgiving
[Date = #date(2025, 12, 25)] // Christmas
},
FilteredSchedule = Table.RemoveMatchingRows(
MaintenanceSchedule,
USHolidays,
{"Date"}
)
in
FilteredSchedule
Result:
#table(type table[Task = text, Date = date],
{
{"HVAC Check", #date(2025, 7, 10)},
{"Fire Drill", #date(2025, 9, 17)}
})
Category
Table.Membership