Forum Discussion

cherrybi_com's avatar
cherrybi_com
Frequent Visitor
4 months ago
Solved

How to convert UTC to local time in Power BI using ICAO code (with DST handling)

I have a fact table which contains Time column stored in UTC, and a Icao column (ICAO airport code) that identifies where each flight was handled. I need to convert the UTC time to the correct local ...
  • danextian's avatar
    4 months ago

    Hi cherrybi_com 

    UTC time can be converted to a local timezone in Power Query, but the conversion is generally offset-based rather than rules-based. In practice, Power Query typically adds or subtracts a fixed number of hours from a datetime value. It does not inherently determine whether a location is currently observing daylight saving time (DST), nor does it automatically apply historical or regional DST transition rules unless that logic is explicitly built into the solution. As a result, a simple UTC offset (for example, UTC+10) may be correct part of the year but incorrect when DST shifts the local time to UTC+11.


    Another limitation is that Power Query does not natively understand location identifiers such as airport or market codes like an ICAP airport code. It does not recognize that a code may correspond to a specific geography, time zone, or set of DST rules. For that, a mapping table is typically needed to translate the code into a timezone identifier or offset before any conversion can be applied.

     

    Below is an example of timezone conversion

    // converts a datetimezone value from UTC to UTC+11
    DateTimeZone.SwitchZone([UTC DateTimeZone Column], 11)