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.

Time Zone Data is Inconsistent

I have pulled data from a source that has a few columns with times in UTC. In the query editor, I created a few corresponding custom column to convert it to the Pacific time zone (-7:00 UTC). 

 

An example of the code I used:

 

= Table.AddColumn(#"Added Custom", "Modified On - Date Time (PST)", each DateTimeZone.SwitchZone([#"Modified On - Date Time (UTC)"],-7)) 

 

I then see the following in the query editor -- the times are correct.

 

Query Editor Data Preview

 

I think to myself "yeah, this looks right", and I go on my merry way. I noticed, though, that Power BI is not remembering this time shift. When I look at the Data view of this dataset, I see

 

The times are the same, as if they were in the same timezone! Why is this happening? 

Status: Needs Info
Comments
MattSarb
New Member

In my data, I had columns of date time values in the UTC timezone. To convert them to PST, I used the following formula.

 

= Table.AddColumn(#"Added Custom", "Modified On - Date Time (PST)", each DateTimeZone.SwitchZone([#"Modified On - Date Time (UTC)"],-7))

I see that, in my Query Editor view, the time values changed. 

 

 

When I applied the query and looked at the data, I saw that the times did not change between the two columns and I do not know why.

 

I do not know why this is happening. Does anyone have any ideas, or is this truly some bug?

v-qiuyu-msft
Community Support

Hi @MattSarb,

 

Based on my test in Power BI desktop version 2.48.4792.721 64-bit (July 2017), the datetime in Data View is the same as in Query Editor. In your scenario, please try to modify the modified column like below:

 

= Table.AddColumn(#"Changed Type1", "Custom.1", each DateTimeZone.RemoveZone(DateTimeZone.SwitchZone([#"Created On -Date Time (UTC)"],-7)))

 

You can download our test file to test in your environment.

 

Best Regards,
Qiuyun Yu

Vicky_Song
Impactful Individual
Status changed to: Needs Info