Table.Split

Updated on

Table.Split is a Power Query M function that splits a table into a list of tables based on a pageSize, where each table contains pageSize rows from the source table. The function returns a list of tables.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

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

Description

Table.Split splits the specified table into a list of tables using the specified page size. It divides table into a list where each table contains a set of pageSize rows from the source table.

Examples

Split a table of five records into tables with two records each.

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 )

 /* Output: 
{
    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"]
    } )
}
 */ 

Other functions related to Table.Split are:

BI Gorilla Youtube Channel

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/table-split