RowExpression.From

Updated on

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:

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

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