Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
Anonymous
Not applicable

Data type in Table.TransformColumns

Hi, I found out recently that function Table.TransformColumns lets you specify a 3rd parameter to identify the data type of the transformed column. However that parameter doesn't seem to react the way I expected.


Here's 3 queries illustrating my issue. 

Test 1

let
    Source = Table.FromColumns({{1,2,3}}, {"Test"}),
    #"Transform column" = Table.TransformColumns(Source, {"Test", each _, type number})

in
    #"Transform column"
let

Test 2

    Source = Table.FromColumns({{1,2,3}}, {"Test"}),
    #"Transform column" = Table.TransformColumns(Source, {"Test", each Number.From(_)})

in
    #"Transform column"

Test 3

let
    Source = Table.FromColumns({{1,2,3}}, {"Test"}),
    #"Transform column" = Table.TransformColumns(Source, {"Test", each Number.From(_), type number})

in
    #"Transform column"

Out of those 3 queries, only Test 3 successfully converts the column to type number, the first 2 keep the column as type any. So it seems you have to explicitly cast values to the desired type AND specify that type in the 3rd parameter. I would have thought only specifying the type as an additional parameter (Test 1) would be sufficient to convert the column (as would be the case with function Table.AddColumn).

Any explanation on that? Why would that behaviour differ from Table.AddColumn?

1 REPLY 1
JasonTX
Resolver I
Resolver I

You want to refer to the column rather than each record. Refer to below. To my understanding, the third paramater is used to handle null values.

 

let
Source = Table.FromColumns({{1,2,3}}, {"Test"}),
#"Transform column" = Table.TransformColumns(Source, {"Test", Number.From})
in
#"Transform column"

 

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.