RowExpression.From

RowExpression.From is a Power Query M function that returns the abstract syntax tree (AST) for a function’s body, normalized into a row expression. The function returns an AST if it can be generated, or an error otherwise.

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

Syntax

RowExpression.From( function as function ) as record

Description

Returns the abstract syntax tree (AST) for the body of function, normalized into a row expression:

  • The function must be a 1-argument lambda.
  • All references to the function parameter are replaced with RowExpression.Row.
  • All references to columns are replaced with RowExpression.Column(columnName).
  • The AST will be simplified to contain only nodes of the kinds:
    • Constant
    • Invocation
    • Unary
    • Binary
    • If
    • FieldAccess
    • NotImplemented

An error is raised if a row expression AST cannot be returned for the body of function.

Examples

Returns the AST for the body of the function each [CustomerID] = "ALFKI"

RowExpression.From( each [CustomerName] = "ALFKI" )

// Output:
[
  Kind = "Binary",
  Operator = "Equals"
  Left =  [ Kind = "FieldAccess", MemberName = "CustomerName", Expression = "Record" ]
  Right = [ Kind = "Constant", Value = "ALFKI" ]
]

Other functions related to RowExpression.From are:

BI Gorilla Youtube Channel

Last update: August 28, 2023 | Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/rowexpression-from
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.