Value.ReplaceType

Updated on

Value.ReplaceType is a Power Query M function that replaces the input value’s type with the provided type. The function returns the input value with its type replaced.

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

Syntax

Value.ReplaceType(
   value as any,
   type as type,
) as any

Description

Replaces the value‘s type with the provided type.

Examples

Replace the default type of a record with a more specific type.

// Output: type number
Type.RecordFields( 
    Value.Type( 
        Value.ReplaceType( 
            [Column1 = 123],
            type [Column1 = number]
         )
     )
 )[Column1][Type]

Other functions related to Value.ReplaceType are:

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