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
Syntax
Type.RecordFields( type as type ) as record
Description
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 ]
.
Examples
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 ]
]
*/
Related functions
Other functions related to Type.RecordFields are:
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy