Record.FieldValues

Updated on

Record.FieldValues is a Power Query M function that retrieves a list of the field values in a record. The function returns a list containing the values of all the fields in the input record.

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

Syntax

Record.FieldValues( record as record ) as list

Description

Record.FieldValues retrieves all field values stored in a record and returns them as a list. This function is useful for extracting all the data contained in a record without its field names.

Examples

Retrieving All Field Values from a Record

To retrieve all field values from a record, you can use the following code:

// Output: { "Orange", "Strawberry", "Peach" }
Record.FieldValues( [ Citrus = "Orange", Berry = "Strawberry", StoneFruit = "Peach" ] )

In this example, the Record.FieldValues function takes a record with three fields: Citrus, Berry, and StoneFruit, each with a unique value. The function retrieves these field values and returns them as a list. This is what it looks like:

Record.FieldValues returns all values from a record as list in Power Query

Using Record.FieldValues for the Same Outcome

You can achieve the same result by using the Record.ToList function:

// Output: { "Orange", "Strawberry", "Peach" }
Record.ToList([ Citrus = "Orange", Berry = "Strawberry", StoneFruit = "Peach" ])

Both functions serve the same purpose of converting a record’s field values into a list.

The opposite of this function would be the Record.FieldNames function, which returns all the field names of the record as a list.

Other functions related to Record.FieldValues are:

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

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