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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Changing time From UTC to Local Time

Hello all,

 

I tried multiple functions to change the time from UTC to my local time, but its not working Erliest date.PNG

 

as you can see above in colomnm [EVENT_TIME_UTC], I have the time in UTC and my local time is UTC+3 (Saudi Arabia)

 

The functions I tried have worked, but it doesnt give me changed time, it only adds +3 in the end.

 

I need a funtion that changes the time itself.

 

 

Thank you.

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

HI @Anonymous 

 

Download this sample PBIX file with the following data and measure

 

Create a Calculated Column using this

 

EVENT_TIME_LOCAL = 'Table'[EVENT_TIME_UTC] + TIME(3,0,0)

 

 

Giving this result

utc-local.png

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

3 REPLIES 3
PhilipTreacy
Super User
Super User

HI @Anonymous 

 

Download this sample PBIX file with the following data and measure

 

Create a Calculated Column using this

 

EVENT_TIME_LOCAL = 'Table'[EVENT_TIME_UTC] + TIME(3,0,0)

 

 

Giving this result

utc-local.png

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


negi007
Community Champion
Community Champion

@Anonymous You can do it in the powerquery window, open your data in the powerquery window and then add a custom column

 

use the below code in the custom colum

= Table.AddColumn(#"Changed Type", "Custom", each DateTime.AddZone([Time in UTC],2,30))

negi007_0-1612087232717.png

 

then change the data type of the new column to Date/Time like below

negi007_5-1612087376713.png

 

 

you are done. let me know if you face any trouble

 

 




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



Proud to be a Super User!


Follow me on linkedin

themistoklis
Community Champion
Community Champion

Hello @Anonymous 

 

Are you trying to do the datetime transformation using Power Query or DAX?

 

Have you tried using the DateTime.AddZone and DateTimeZone.SwitchZone functions in Power Query?

https://docs.microsoft.com/en-us/powerquery-m/datetime-addzone

https://docs.microsoft.com/en-us/powerquery-m/datetimezone-switchzone

 

https://www.poweredsolutions.co/2019/10/21/handling-different-time-zones-in-power-bi-power-query/

 

Example in Power Query: 

DateTimeZone.ToLocal(DateTime.AddZone([date_created_UTC],3))

 

 

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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