Value.As is a Power Query M function that returns the input value if it is compatible with the specified type. The function returns the value casted to the specified type if compatible, otherwise, it returns an error.

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


   value as any,
   type as type,
) as any


Returns the value if it is compatible with the specified type. This is equivalent to the “as” operator in M, with the exception that it can accept identifier type references such as Number.Type.


Cast a number to a number.

// Output: 123
Value.As( 123, Number.Type )

Attempt to cast a text value to a number.

// Output: [Expression.Error] We cannot convert the value "abc" to type Number.
Value.As( "abc", type number )

Other functions related to Value.As are:

BI Gorilla Blog

Last update: August 25, 2023 | Contribute » | Contributors: Rick de Groot
Microsoft documentation:
© 2023 BI Gorilla. All rights reserved. Content derived from Microsoft documentation is property of Microsoft Corp.