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

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

Reply
EaglesTony
Post Prodigy
Post Prodigy

Changing type to date is causing date to go to next day

Hi,

 

  I have this data coming in:

EaglesTony_0-1731074781937.png

 

  When I change the type to "Date", it shows me 11/18/2024 instead of 11/19/2024 ???

EaglesTony_1-1731074847998.png

 

1 ACCEPTED SOLUTION

Looking at it another way, it DOES take into account your region settings. The original is of type datetimezone and the +00:00 indicates it is UTC. When you convert it to type date, it changes it to the date in your local timezone. For END_DATE that happens to be the previous day. 

 

How to handle this depends on what you are trying to accomplish. If you want to keep the Date part the same as if you were using UTC, then you can remove the timezone information.

View solution in original post

10 REPLIES 10
Omid_Motamedise
Memorable Member
Memorable Member

it is because of time zoon. your value is in time zoon + 00:00 and when you convert it into date your time zoon will be added into it.


EaglesTony
Post Prodigy
Post Prodigy

Keep it UTC how ?...This data is coming from another system...is there a way I could adjust it back 5 hours ?

Yes, Power Query offers functions to add, remove, or change timezones. 

 

Converting a datetimezone to date will recalculate the date.  Removing the timezone first will not recalculate the date.

 

You can choose which way to do this.

EaglesTony
Post Prodigy
Post Prodigy

I am in the Eastern Time Zone.

That would explain it.

 

What is your expected result? And why?

lbendlin
Super User
Super User

You seem to live in a timezone west of Greenwich? (But not that much, less than 20 hrs)

So your saying, since I am 5 hours behind, PowerBI doesn't take into account my region settings(EST) and changes it back 5 hours (in this case would be 11/18/2024 11pm, I assume) ?

Looking at it another way, it DOES take into account your region settings. The original is of type datetimezone and the +00:00 indicates it is UTC. When you convert it to type date, it changes it to the date in your local timezone. For END_DATE that happens to be the previous day. 

 

How to handle this depends on what you are trying to accomplish. If you want to keep the Date part the same as if you were using UTC, then you can remove the timezone information.

Yes, I just want to keep the date part.

 

This is the solution:

 

1) First remove the timezone using DateTimeZone.RemoveZone 

2) Convert it to a Date 

correct.  Stuff like this is the main reason why everything should be kept in UTC.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

October NL Carousel

Fabric Community Update - October 2024

Find out what's new and trending in the Fabric Community.