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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Date value changes when transforming column type

I cannot figure out why changing a "DateTimeZone" column to type "Date" causes the date value to change.

 

First I convert my UTC DateTime to IST DateTimeZone

= Table.AddColumn(#"table from database", "IST Time", each DateTimeZone.SwitchZone(DateTime.AddZone([CreatedOn],0), 5.5), type datetimezone)

Then I convert to Date format

= Table.TransformColumnTypes(#"Duplicated Column",{{"IST Time", type date}})

 

I have outlined the dates which have been 'converted' incorrectly (Showing a copy column of Step 1 for demonstration)

cshan_1-1611034798596.png

 

I can't figure out what's going wrong. My only thought is my machines system time zone offset (+11) could be impacting it. But the threshold for when Power Bi gets it wrong doesn't seem to add up.

 

Thanks for the help

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Ok... I tried using Date.From() but noticed in the doco it says:

  • datetimezone: The date component of the local datetime equivalent of value.

..... So, it uses "local" datetime equivalent. Unsurprisingly, it gave me the same "error" as using Table.TransformColumnTypes

 

It didn't take long on the doco page, though, to find the answer: DateTimeZone.RemoveZone()

(then change column to "Date" format 🙂)

= Table.AddColumn(#"Changed Type", "DateTimeFrom", each DateTimeZone.RemoveZone([IST Time2]), type datetime)

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Ok... I tried using Date.From() but noticed in the doco it says:

  • datetimezone: The date component of the local datetime equivalent of value.

..... So, it uses "local" datetime equivalent. Unsurprisingly, it gave me the same "error" as using Table.TransformColumnTypes

 

It didn't take long on the doco page, though, to find the answer: DateTimeZone.RemoveZone()

(then change column to "Date" format 🙂)

= Table.AddColumn(#"Changed Type", "DateTimeFrom", each DateTimeZone.RemoveZone([IST Time2]), type datetime)

 

Helpful resources

Announcements
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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.