Expression.Evaluate
This function evaluates an M expression document and returns the result. It takes into account the available identifiers that are defined in the environment and can be referenced within the document.
This function evaluates an M expression document and returns the result. It takes into account the available identifiers that are defined in the environment and can be referenced within the document.
Example 1
Assess a basic addition calculation.
Usage
Power Query MExpression.Evaluate("1 + 1")
Output
2
Example 2
Assess a more intricate addition calculation.
Usage
Power Query MExpression.Evaluate("List.Sum({1, 2, 3})", [List.Sum = List.Sum])
Output
6
Example 3
Assess the merging of a text value with an identifier.
Usage
Power Query MExpression.Evaluate(Expression.Constant("""abc") & " & " & Expression.Identifier("x"), [x = "def"""])
Output
"""abcdef"""