Table.TransformColumnTypes

Table.TransformColumnTypes is a Power Query M function that returns a table from the input table by applying the transform operation to the columns specified in the parameter typeTransformations and the specified culture. The function returns a table with the specified column types transformed.

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

Syntax

Table.TransformColumnTypes(
   table as table,
   typeTransformations as list,
   optional culture as nullable text,
) as table

Description

Returns a table from the input table by applying the transform operation to the columns specified in the parameter typeTransformations (where format is { column name, type name}), using the specified culture in the optional parameter culture (for example, “en-US”). If the column doesn’t exist, an exception is thrown.

Examples

Transform the number values in column [a] to text values from the table ( {[a = 1, b = 2], [a = 3, b = 4]} ).

Table.TransformColumnTypes( 
    Table.FromRecords( {
        [a = 1, b = 2],
        [a = 3, b = 4]
    } ),
    {"a", type text},
    "en-US"
 )

 /* Output: 
Table.FromRecords( {
    [a = "1", b = 2],
    [a = "3", b = 4]
} )
 */ 

Other functions related to Table.TransformColumnTypes are:

BI Gorilla Blog

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