Forum Discussion

Betsy's avatar
Betsy
Helper IV
10 years ago
Solved

Convert UTC to client time zones?

Hi,   I have date/time information imported from csv files in UTC format. I also have imported time zone information for my various clients. What I'd like to do is create a series of calculated col...
  • v-caliao-msft's avatar
    10 years ago

    Hi Betsy,

     

    We may take a try with the method below:

    Assuming currently we have the Time and UTC column in a table, where [Time] stores the actual UTC time, [UTC] stores the changed hour count between client and UTC.
    Based on the different Time Zone, UTC values changes within -12 to 12 range.


     

    When data loaded into Power BI, open Query Editor, under the Add column tab, click Add Custom Column, then under the formula part, copy and paste the following:
    DateTime.AddZone([Time],0)

     

    Click OK. This step adds the default UTC Time Zone (0 here) under the time stored in [Time], to the newly created ZoneTime column;
    After that, we need to create another column to switch the time zone to the client, also click on the Add custom column, then copy and paste the following formula:
    DateTimeZone.SwitchZone([ZoneTime],[UTC])

     

    After that, we have successfully added the time Zone information into the time. Then we need format the column into date/time/timezone format.
    Select ClientTime column, navigate to Transform tab, choose data type and select Date/Time/TimeZone:

     

    After that, click close and apply.
    Till then we should have finished converting the time into Client local time.


    If any further questions, please feel free to post back.

     

    Regards,

    Charlie Liao