Table.FromRecords

Table.FromRecords is a Power Query M function that converts a list of records into a table. The function returns a table composed of the input records.

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

Syntax

Table.FromRecords(
   records as list,
   optional columns as any,
   optional missingField as nullable number,
) as table

Description

Converts records, a list of records, into a table.

Examples

Create a table from records, using record field names as column names.

Table.FromRecords( {
    [CustomerID = 1, Name = "Bob", Phone = "123-4567"],
    [CustomerID = 2, Name = "Jim", Phone = "987-6543"],
    [CustomerID = 3, Name = "Paul", Phone = "543-7890"]
} )

 /* Output: 
Table.FromRecords( {
    [CustomerID = 1, Name = "Bob", Phone = "123-4567"],
    [CustomerID = 2, Name = "Jim", Phone = "987-6543"],
    [CustomerID = 3, Name = "Paul", Phone = "543-7890"]
} )
 */ 

Create a table from records with typed columns and select the number columns.

// Output: {"CustomerID"}
Table.ColumnsOfType( 
    Table.FromRecords( 
        {[CustomerID = 1, Name = "Bob"]},
        type table[CustomerID = Number.Type, Name = Text.Type]
     ),
    {type number}
 )

Learn more about Table.FromRecords in the following articles:

Other functions related to Table.FromRecords are:

BI Gorilla Youtube Channel

Last update: August 28, 2023 | Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/table-fromrecords
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.