Updated on

Type.RecordFields is a Power Query M function that extracts a record describing the fields of a given record type, with corresponding names and values in the form of a record [ Type = type, Optional = logical ]. The function returns a record with information about the fields of the input record type.

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


Type.RecordFields( type as type ) as record


The Type.RecordFields function returns a record describing the fields of a record type. Each field of the returned record type has a corresponding name and a value, in the form of a record [ Type = type, Optional = logical ].


Let’s look at some examples.

When you have a record like type [ myDate = date, optional Amount = number ], you can return information about both the fields and the data types.

Type.RecordFields( type [ myDate = date, optional Amount = number ] )
 /* Output: 
    myDate = [Type = type date, Optional = false],
    Amount = [Type = type number, Optional = true]

In case you don’t specify a type for one of the fields within your record, it automatically receives type any.

Type.RecordFields( type [ myDate, Amount = nullable list ] )
 /* Output: 
    myDate = [ Type = type any, Optional = false ],
    Amount = [ Type = type nullable list, Optional = false ]

Other functions related to Type.RecordFields are:

BI Gorilla Youtube Channel

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