Forum Discussion

manoj_0911's avatar
manoj_0911
Icon for Kudo Commander rankKudo Commander
1 year ago
Solved

DATE from SQL Server (in PST) treated as UTC when imported into Power BI and published to the

DATE from SQL Server (in PST) treated as UTC when imported into Power BI and published to the service?   Hi experts, I have a question about time zone handling in Power BI. In my SQL Server sourc...
  • Akash_Varuna's avatar
    1 year ago

    Hi manoj_0911 Power BI treats datetime values as UTC if no timezone is specified, potentially misinterpreting your PST data. Use DateTimeZone.SwitchZone in Power Query to convert the PST datetime explicitly to UTC. This ensures consistency during incremental and scheduled refreshes. Standardizing datetime handling in Power Query helps maintain accurate timezone representation.

  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi manoj_0911  ,


    Thanks for the clarification. Just to summarize for others who might have a similar scenario.

    • Power BI does treat datetime as UTC internally if no timezone info is explicitly attached.
    • Since the TXN_DATE from SQL Server is already in Pacific Time (PST/PDT), Power BI may misinterpret it as UTC unless handled properly.
    • To preserve the original PST timezone, it’s a best practice to use this step in Power Query.

     Add this in M language.

    DateTimeZone.SwitchZone([TXN_DATE], -8) or use -7 during daylight saving time, or make it dynamic.
    • This adjustment is especially important if you're using incremental refresh, time-based filtering, or scheduled refresh in Power BI Service, which all assume UTC by default.

    By applying DateTimeZone.SwitchZone, you’re explicitly telling Power BI what the timezone is which avoids unexpected shifts and ensures consistent behavior both in Desktop and Service environments.

    If this response helps, consider marking it as “Accept as solution” and giving a “kudos” to assist other community members.

    Regards,
    Akhil.

  • burakkaragoz's avatar
    1 year ago

    Hi manoj_0911 ,

     

    You need to convert your datetime to datetimezone first, then use SwitchZone. Try this in Power Query:

    DateTimeZone.SwitchZone(
        DateTimeZone.From([TXN_DATE]), 
        -8
    )

    For PST with basic DST handling:

    DateTimeZone.SwitchZone(
        DateTimeZone.From([TXN_DATE]), 
        if Date.Month([TXN_DATE]) >= 3 and Date.Month([TXN_DATE]) <= 10 then -7 else -8
    )

    Why this matters:

    • Power BI Service always uses UTC for scheduled refresh
    • Incremental refresh compares dates in UTC
    • Without proper timezone handling, your time-based filters will be off

    The key thing I missed in my research - you can't use SwitchZone directly on datetime fields from SQL. You have to convert to datetimezone first using DateTimeZone.From().

    This should keep your times consistent between Desktop and Service.


    If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.

    This response was assisted by AI for translation and formatting purposes.