Table.Split
Table.Split(table as table, pageSize as number) as list
將 table
分割成資料表清單,其中清單第一個項目為包含來源資料表前 pageSize
個資料列的資料表,清單下一個項目則是包含來源資料表後 pageSize
個資料列的資料表,以此類推。
將具有五個記錄之資料表分割為各擁有兩個記錄的資料表。
使用方式
let
Customers = Table.FromRecords({
[CustomerID = 1, Name = "Bob", Phone = "123-4567"],
[CustomerID = 2, Name = "Jim", Phone = "987-6543"],
[CustomerID = 3, Name = "Paul", Phone = "543-7890"],
[CustomerID = 4, Name = "Cristina", Phone = "232-1550"],
[CustomerID = 5, Name = "Anita", Phone = "530-1459"]
})
in
Table.Split(Customers, 2)
輸出
{
Table.FromRecords({
[CustomerID = 1, Name = "Bob", Phone = "123-4567"],
[CustomerID = 2, Name = "Jim", Phone = "987-6543"]
}),
Table.FromRecords({
[CustomerID = 3, Name = "Paul", Phone = "543-7890"],
[CustomerID = 4, Name = "Cristina", Phone = "232-1550"]
}),
Table.FromRecords({
[CustomerID = 5, Name = "Anita", Phone = "530-1459"]
})
}