Forum Discussion

mh20221111's avatar
mh20221111
Helper II
7 days ago

Date.From(datetimezone) returns different results when using On-Premises Gateway

Hi all,

I found what appears to be a date conversion inconsistency in Power BI Dataflow Gen1 when an On-Premises Data Gateway is used.

Power BI Dataflow Gen1
Power BI Service
Same workspace
Same dataflow
Comparison : Without gateway & With on-premises gateway

let UTC = DateTimeZone.UtcNow(), JST = UTC + #duration(0,9,0,0), Date1 = Date.From(JST), Date2 = Date.From(DateTimeZone.RemoveZone(JST)) in #table( {"UTC","JST","Date1","Date2"}, {{UTC,JST,Date1,Date2}} )
Expected Result:Both Date1 and Date2 should return the same date because they represent the same instant.

Date1 = 2026-08-31
Date2 = 2026-08-31

Actual Result:
Without gateway:
Date1 = 2026-08-31
Date2 = 2026-08-31

With gateway:
Date1 = 2026-09-01
Date2 = 2026-08-31

 

4 Replies

  • Hi,

    This looks like a timezone handling difference between the Power BI Service and the On-premises Data Gateway, rather than an issue with Date.From() itself.

    Date.From(JST) is working with a datetimezone value, so the gateway may be applying its local/system timezone when converting it to a date. DateTimeZone.RemoveZone(JST) removes the timezone information first, which is why Date2 remains unchanged.

    Since the behavior differs between execution with and without the gateway, I would treat this as a gateway/runtime timezone inconsistency and avoid relying on implicit timezone conversion.

    As a workaround, explicitly remove or apply the required timezone before extracting the date, for example:

    Date.From(DateTimeZone.RemoveZone(JST))

    Also check the gateway machine's regional/timezone settings, as these can influence datetime conversions.

    If the same M code produces different results in the Service depending only on whether the gateway is used, it would be worth raising this with Microsoft Support as a potential gateway/Dataflow Gen1 issue.

    Hope this Helps!

    Thanks

    • mh20221111's avatar
      mh20221111
      Helper II

      SamInogic​  
      Thank you for your explanation.
      Adding DateTimeZone.RemoveZone() resolved the issue, and I have updated my dataflow to use this approach as a workaround.
      I appreciate your help and insights.

      • SamInogic's avatar
        SamInogic
        Super User

        Hi,

        Glad to know our solution worked for you.

        Can you please mark our solution as accepted solution so that next time if someone else has same issue they will know our solution would work since it worked for you and hence you marked as accepted.

        Thanks!

  • v-kathullac's avatar
    v-kathullac
    Community Support

    Hi mh20221111​ ,

    Glad to Hear that your issue got resolved Let us know if you need any further assistance.

    Regards,

    Chaithanya.