Record.HasFields is a Power Query M function that checks if a record has the specified fields and returns a logical value (true or false). The function returns true if all the specified fields are present in the input record, otherwise false.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Record.HasFields(
record as record,
fields as any,
) as logical
Description
Indicates whether the record record
has the fields specified in fields
, by returning a logical value (true or false).
Multiple field values can be specified using a list.
Examples
Check if the record has the field “CustomerID”.
// Output: true
Record.HasFields( [CustomerID = 1, Name = "Bob", Phone = "123-4567"], "CustomerID" )
Check if the record has the field “CustomerID” and “Address”.
// Output: false
Record.HasFields( [CustomerID = 1, Name = "Bob", Phone = "123-4567"], {"CustomerID", "Address"} )
Related functions
Other functions related to Record.HasFields are:
