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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
arielcedola
Helper III
Helper III

Transforming values in column without creating new columns in M language

Hi,

I'm using m language to perform the following convertions of datetime data:

1) unix timestamp to utc date time zone

2) utc date time zone to local time zone

3) local time zone to datetime

The query I'm using is the following:

 

let

....

#"unix to utc" = Table.AddColumn(#"previous step", "timestamp_utc", each #datetimezone(1970,1,1,0,0,0,0,0) + #duration(0,0,0,[data])),
#"utc to local" = Table.AddColumn(#"unix to utc", "timestamp_local", each DateTimeZone.ToLocal([timestamp_utc])),
#"to datetime" = Table.AddColumn(#"utc to local", "timestamp", each DateTime.From([timestamp_local]))
in
#"to datetime"

 

Unix datetime data is in the column [data] of my table.

Every step in the query introduces a new column: timestamp_utc, timestamp_local and timestamp. My question is, how can I perform the same functions and get the same result as in the last column timestamp, but without introducing the intermediate columns timestamp_utc and timestamp_local?

Thanks .)

1 ACCEPTED SOLUTION
camargos88
Community Champion
Community Champion

Hi @arielcedola ,

 

Try nesting the functions:

 

Table.AddColumn(#"previous step", "timestamp_utc", each DateTime.From(DateTimeZone.ToLocal(#datetimezone(1970,1,1,0,0,0,0,0) + #duration(0,0,0,[data]))))

 

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



View solution in original post

2 REPLIES 2
camargos88
Community Champion
Community Champion

Hi @arielcedola ,

 

Try nesting the functions:

 

Table.AddColumn(#"previous step", "timestamp_utc", each DateTime.From(DateTimeZone.ToLocal(#datetimezone(1970,1,1,0,0,0,0,0) + #duration(0,0,0,[data]))))

 

 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



Exactly! I tried nesting the functions before but for some reason it didn't work. Now it did it perfectly.

Thanks .)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors