Function.ScalarVector is a Power Query M function that returns a scalar function of a specified type that invokes a vector function with a single row of arguments and returns its single output. The function returns the new scalar function.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Function.ScalarVector(
scalarFunctionType as type,
vectorFunction as function,
) as function
Description
Returns a scalar function of type scalarFunctionType
that invokes vectorFunction
with a single row of arguments and returns its single output. Additionally, when the scalar function is repeatedly applied for each row of a table of inputs, such as in Table.AddColumn, instead vectorFunction
will be applied once for all inputs.
vectorFunction
will be passed a table whose columns match in name and position the parameters of scalarFunctionType
. Each row of this table contains the arguments for one call to the scalar function, with the columns corresponding to the parameters of scalarFunctionType
.
vectorFunction
must return a list of the same length as the input table, whose item at each position must be the same result as evaluating the scalar function on the input row of the same position.
The input table is expected to be streamed in, so vectorFunction
is expected to stream its output as input comes in, only working with one chunk of input at a time. In particular, vectorFunction
must not enumerate its input table more than once.
Related articles
Learn more about Function.ScalarVector in the following articles:
- Using Function.ScalarVector() To Optimise Calls To M Functions
Optimize your M code for web services and calculations with Function.ScalarVector(). This guide shows how to batch up requests for efficiency while maintaining ease-of-use. » Read more
Related functions
Other functions related to Function.ScalarVector are:
- Function.From
- Function.Invoke
- Function.InvokeAfter
- Function.InvokeWithErrorContext
- Function.IsDataSource
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy