Type.ForFunction

Generates a function type based on its signature, which includes details about the return type, parameters, and the minimum number of arguments needed to call the function.

Syntax

Type.ForFunction(signature as record, min as number) as type

About

Generates a function type based on its signature, which includes details about the return type, parameters, and the minimum number of arguments needed to call the function.

Explanation

This code defines the data type for a function that requires a numerical input parameter called X and outputs a number. The function can be utilized using the Power Query MType utility. The syntax for this function is as follows: MType.ForFunction([ReturnType = type number, Parameters = [X = type number]], 1). When used, the function will be formatted as: function (X as number) as number.