Type.FunctionReturn

Updated on

Type.FunctionReturn is a Power Query M function that retrieves the type returned by a given function type. The function returns the return type of the input function type.

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

Syntax

Type.FunctionReturn( type as type ) as type

Description

The Type.FunctionReturn function that determines the return type of a specified function. It accepts a type as its input and outputs the type that the function returns. You can provide a custom type or extract the type from a standard library function to see its details.

Examples

So how can you use the Type.FunctionReturn function?

Suppose you want to return the output type of the List.Combine function. The function is used to combine two or more lists and returns a list as output. To test the data type of the output value, you can use the following expression:

// Output: type list
Type.FunctionReturn( Value.Type( List.Combine ) )

An alternative approach is to provide a custom type directly into the function. Let’s say you want to find the return type of: type function ( Name as text, Age as number ) as text. The following code gives you the return type of the function:

// Output: type text
Type.FunctionReturn( type function ( Name as text, Age as number ) as text )

Other functions related to Type.FunctionReturn are:

BI Gorilla Youtube Channel

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