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
RadkaProefo
Regular Visitor

DateTime UTC in Desktop shows as CEST

Hi fellows,

I am using this code in Power query

= #table(type table[LastRefresh=text], {{DateTime.ToText(DateTime.From(DateTimeZone.UtcNow()), [Format="dd.MM.yyyy HH:mm:ss"])&" (UTC)"}})

to show to clients in card, when their report was refreshed last time in UTC time. It works all right in service, but in Desktop it shows not UTC time but CEST time. How is it possible? Thanks for help.

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @RadkaProefo 

 

This is because Power BI Desktop uses your computer’s local time, whereas Power BI Service uses UTC time. This can cause a plethora of problems with reporting the correct date, functions choosing current day, etc. Below are 2 possible methods to get around this issue.

 

Method 1: DAX Measures

Probably the easiest method to use is by simply adding or subtracting the difference of your time zone and UTC time from the DAX NOW() function.

vzhangti_2-1661493489725.png

This method is very easy to put together, simply Google your time zone offset or look it up on a site like below. Then, add or subtract the total from the now function, and you have your proper time in Power BI Service.

 

It is worth noting however, that this method a notable downside. In Power BI Desktop, your time will appear as the computer’s time +/- your offset, rather than UTC +/- the offset, this may make it difficult to test some reporting elements, as they will appear differently in Desktop and Service.

 

Method 2: Power Query

Power Query has inbuilt functions to deal with this issue, namely the DateTimeZone functions. Using the SwitchZone function, it is easy to select your preferred time zone via the method below. As before you can see the -8 offset for PST from UTC (note the 0 in the optional minutes offset, which can be left blank in many cases). If you have data that needs visibility to your DateTime information within Power Query, this method may work best.

vzhangti_4-1661493574905.png

 

 

For reference:

Dynamic time zone conversion using Power BI – The White Pages (tygraph.com)

Auto date/time in Power BI Desktop - Power BI | Microsoft Docs

DateTimeZone functions - PowerQuery M | Microsoft Docs

Solved: UTC to Local time in Power BI Service with DayLigh... - Microsoft Power BI Community

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-zhangti
Community Support
Community Support

Hi, @RadkaProefo 

 

This is because Power BI Desktop uses your computer’s local time, whereas Power BI Service uses UTC time. This can cause a plethora of problems with reporting the correct date, functions choosing current day, etc. Below are 2 possible methods to get around this issue.

 

Method 1: DAX Measures

Probably the easiest method to use is by simply adding or subtracting the difference of your time zone and UTC time from the DAX NOW() function.

vzhangti_2-1661493489725.png

This method is very easy to put together, simply Google your time zone offset or look it up on a site like below. Then, add or subtract the total from the now function, and you have your proper time in Power BI Service.

 

It is worth noting however, that this method a notable downside. In Power BI Desktop, your time will appear as the computer’s time +/- your offset, rather than UTC +/- the offset, this may make it difficult to test some reporting elements, as they will appear differently in Desktop and Service.

 

Method 2: Power Query

Power Query has inbuilt functions to deal with this issue, namely the DateTimeZone functions. Using the SwitchZone function, it is easy to select your preferred time zone via the method below. As before you can see the -8 offset for PST from UTC (note the 0 in the optional minutes offset, which can be left blank in many cases). If you have data that needs visibility to your DateTime information within Power Query, this method may work best.

vzhangti_4-1661493574905.png

 

 

For reference:

Dynamic time zone conversion using Power BI – The White Pages (tygraph.com)

Auto date/time in Power BI Desktop - Power BI | Microsoft Docs

DateTimeZone functions - PowerQuery M | Microsoft Docs

Solved: UTC to Local time in Power BI Service with DayLigh... - Microsoft Power BI Community

 

Best Regards,

Community Support Team _Charlotte

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

And how is it with winter and summer? Because it is 1 or 2 hours to switch?

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.