Record.FieldCount

Updated on

Record.FieldCount is a Power Query M function that calculates the number of fields in a given record. The function returns the total number of fields present in the input record.

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

Syntax

Record.FieldCount( record as record ) as number

Description

The Record.FieldCount function counts the number of fields in a specified record and returns this count as a number.

Examples

Imagine you have the following record:

[ Citrus = "Orange", Berry = "Strawberry", StoneFruit = "Peach" ]

To find out how many fields are in this record, you can use the Record.FieldCount function. Here’s the code:

// Output: 3
Record.FieldCount( [ Citrus = "Orange", Berry = "Strawberry", StoneFruit = "Peach" ] )

In this example, we have a record with three fields: Citrus, Berry, and StoneFruit. The Record.FieldCount function is used to count these fields. When you run the code, the function returns the number 3, which is the number of fields in the record.

Other functions related to Record.FieldCount are:

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

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy