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
kadapavel
Helper II
Helper II

Keep UTC 00:00 in time stamp

Hello,

Please support and possibly advise solution..

My sensor data timestamps are stored in database in UTC 00:00, when I download it and process outside power bi(i process the data with R script) results are linked to time stamp 00:00.

Then I upload it to Power bi where timestamp is converted to my local time stamp but results are linked to UTC 00:00, as a resut is mess up charts and conclusions.

 

Is there a way to keep Power bi time setting so that timestams are not converted to local time?

 

BR

1 ACCEPTED SOLUTION
MarcelBeug
Community Champion
Community Champion

Based on your limited information: your input should be imported as datetimezone values. Instead of converting to type datetime, you can use function DateTimeZone.RemoveZone, which will cut off the time zone without converting the times to your local time.

 

Alternatively you can keep the values as datetimezone values in the Query Editor, as the zone will be cut off anyhow when loading into the datamodel.

 

Illustrative query: the first 2 columns will load as UTC, the third will load in your local date/time.

 

let
    Source = #table(type table[DTZ = datetimezone],{{#datetimezone(2017,12,5,11,53,0,0,0)}}),
    #"Added Custom" = Table.AddColumn(Source, "DT UTC", each DateTimeZone.RemoveZone([DTZ]), type datetime),
    #"Duplicated Column" = Table.DuplicateColumn(#"Added Custom", "DTZ", "DT Converted"),
    #"Changed Type" = Table.TransformColumnTypes(#"Duplicated Column",{{"DT Converted", type datetime}})
in
    #"Changed Type"

 

Specializing in Power Query Formula Language (M)

View solution in original post

1 REPLY 1
MarcelBeug
Community Champion
Community Champion

Based on your limited information: your input should be imported as datetimezone values. Instead of converting to type datetime, you can use function DateTimeZone.RemoveZone, which will cut off the time zone without converting the times to your local time.

 

Alternatively you can keep the values as datetimezone values in the Query Editor, as the zone will be cut off anyhow when loading into the datamodel.

 

Illustrative query: the first 2 columns will load as UTC, the third will load in your local date/time.

 

let
    Source = #table(type table[DTZ = datetimezone],{{#datetimezone(2017,12,5,11,53,0,0,0)}}),
    #"Added Custom" = Table.AddColumn(Source, "DT UTC", each DateTimeZone.RemoveZone([DTZ]), type datetime),
    #"Duplicated Column" = Table.DuplicateColumn(#"Added Custom", "DTZ", "DT Converted"),
    #"Changed Type" = Table.TransformColumnTypes(#"Duplicated Column",{{"DT Converted", type datetime}})
in
    #"Changed Type"

 

Specializing in Power Query Formula Language (M)

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.