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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Dicken
Post Prodigy
Post Prodigy

Transform Column / Type



Hello, 
Can some one explain this ;   

= Table.TransformColumns( Source, 
{ "Date", each Date.From(_)    } 

which does what it say   "date"  now = a date ; 
but if I dispense with the full syntax 

= Table.TransformColumns( Source, 
{ "Date", Date.From } )

I now also transforms the date type ?  which is useful, just wondered why  ? 

Richard.

1 ACCEPTED SOLUTION
MasonMA
Super User
Super User

Hi @Dicken 

 

I think it's the behavior of Table.TransformColumns. If you see 

Table.TransformColumns - Table Function | Power Query M

this function decides how to apply the transformation function to each value or whether to update the column type metadata.

 

In { "Date", each Date.From(_) }, Table.TransformColumns only sees a custom lambda, “(x) => Date.From(x)”. It doesn’t know the return type of this lambda, so it leaves the column type metadata unchanged.

While in { "Date", Date.From }, Table.TransformColumns sees a native function that has a declared return type in the M library (type date). Since it knows that return type, it sets the column’s metadata to date as well.

 

Ran a simple test below, 

let
    Query1 = 
  let
    Source = #table(type table [Date = text], {{"2025-08-22"}}),
    Transform1 = Table.TransformColumns(Source, {"Date", each Date.From(_)}),
    Transform2 = Table.TransformColumns(Source, {"Date", Date.From})
  in
    { Transform1, Transform2 }
in
    Query1

MasonMA_1-1755879371212.pngMasonMA_0-1755879344613.png

View solution in original post

3 REPLIES 3
MasonMA
Super User
Super User

Hi @Dicken 

 

I think it's the behavior of Table.TransformColumns. If you see 

Table.TransformColumns - Table Function | Power Query M

this function decides how to apply the transformation function to each value or whether to update the column type metadata.

 

In { "Date", each Date.From(_) }, Table.TransformColumns only sees a custom lambda, “(x) => Date.From(x)”. It doesn’t know the return type of this lambda, so it leaves the column type metadata unchanged.

While in { "Date", Date.From }, Table.TransformColumns sees a native function that has a declared return type in the M library (type date). Since it knows that return type, it sets the column’s metadata to date as well.

 

Ran a simple test below, 

let
    Query1 = 
  let
    Source = #table(type table [Date = text], {{"2025-08-22"}}),
    Transform1 = Table.TransformColumns(Source, {"Date", each Date.From(_)}),
    Transform2 = Table.TransformColumns(Source, {"Date", Date.From})
  in
    { Transform1, Transform2 }
in
    Query1

MasonMA_1-1755879371212.pngMasonMA_0-1755879344613.png

Thanks ,  

RD

(_) as date => Date.From(_)

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.

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.