Expression.Constant

Updated on

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:

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