Updated on

Type.IsOpenRecord is a Power Query M function that checks if a given record type is open. The function returns a boolean indicating whether the record type is open or not.

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


Type.IsOpenRecord( type as type ) as logical


The Type.IsOpenRecord function tests whether or not a record type is open. An open record is a flexible data structure that allows for the inclusion of additional fields beyond those explicitly defined. You can define an open record using the open-record-marker, represented by ‘…’. This marker indicates that the record can include other fields beyond those defined.


Defining an Open Record

To define an open record you can use the open-record-mark represented by ‘…’. You can incorporate this in a record type expression in the following way:

type [ myDate = date, mytext = text, ... ] 

Here, the type explicitly defines two fields, myDate and mytext, along with their respective data types, date and text. The inclusion of the open-record-marker (...) indicates that this record type can accommodate additional fields.

Test for Open Record

To determine whether a given type is an open record, you can use the Type.IsOpenRecord function. This function evaluates a type and returns a boolean value indicating whether it is an open record.

For instance:

Type.IsOpenRecord( type [ myDate = date, mytext = text, ... ]  ) // Output: true

This expression will return true, confirming that the specified type is an open record.

Comparing Open Records and Primitive Type Record

It’s important to note that in Power Query M, the primitive record type is considered an open type. This means that a record type defined solely with the open-record-marker is equivalent to the primitive type record. For example:

type [ ... ]  = type record // Output: true

Similarly, the following expression also evaluates to true, as the primitive record type is inherently an open record:

Type.IsOpenRecord( type record ) // Output: true

Working with Closed Records

In contrast to open records, a closed record is one where the fields are strictly defined, and no additional fields are allowed. When the Type.IsOpenRecord function is applied to a closed record, it returns false, indicating the fixed structure of the record type. For example:

Type.IsOpenRecord( type [ myDate = date, mytext = text ]  ) // Output: false

This demonstrates that the specified record type does not allow for additional fields beyond myDate and mytext.

Other functions related to Type.IsOpenRecord are:

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