Type.ListItem

Updated on

Type.ListItem is a Power Query M function that retrieves the item type from a list type. The function returns the item type contained within the input list type.

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

Syntax

Type.ListItem( type as type ) as type

Description

The Type.ListItem function allows you to return the type of value that can be found within a custom list type. The regular type list is generic and does not add any constraints to a type. However, custom list types allow you to specify what values a list can contain.

For instance, type { text } indicates that the values in a list conform to the type text.

Examples

When you specify a custom list type, you may want to test what type of values the list type classifies. To do that you can make use of the Type.ListItem function.

Suppose you have classified a list of values with type { text }. The following expression returns the type values the list conforms to.

// Output: type text
Type.ListItem( type { text } )

You can also apply this function to the primitive type list. The more generic type list expression automatically receives type any for any values it contains.

// Output: type any
Type.ListItem( type list )

Other functions related to Type.ListItem are:

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

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