Expression.Constant

Expression.Constant is a Power Query M function that generates the M source code representation of a constant value. The function returns a text value representing the M code.

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

Syntax

Expression.Constant( value as any ) as text

Description

Returns the M source code representation of a constant value.

Examples

Get the M source code representation of a number value.

// Output: "123"
Expression.Constant( 123 )

Get the M source code representation of a date value.

// Output: "#date( 2035, 1, 2 )"
Expression.Constant( #date( 2035, 01, 02 ) )

Get the M source code representation of a text value.

// Output: """abc"""
Expression.Constant( "abc" )

Other functions related to Expression.Constant are:

BI Gorilla Blog

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