Forum Discussion

katto16's avatar
katto16
Icon for Helper I rankHelper I
2 years ago

Time zone conversion not working in Power BI service

I've been trying this using a few different formulas and it wasn't working. In Pbi service, when the report was just published, it worked but after a while, it went back to UTC.

 

DateTimeZone.SwitchZone(DateTimeZone.LocalNow(),8,0)

 

 

This is the visual in powerbi service.

Trying to add 8hrs to UTC. 

I also tried using DAX measure but for some reason, it was showing the time the visuals are refreshed and not the dataset refresh so it didn't work as I intended so I went back to doing it in Power Query
Anyone knows how to resolve this?

Thanks.

 

2 Replies

  • arvindsingh802's avatar
    arvindsingh802
    Icon for Community Champion rankCommunity Champion

    Instead of DateTimeZone.LocalNow(), use DateTimeZone.UtcNow()
    as LocalNow will give you time of the region in which your power bi tenant/capacity resides.

    • katto16's avatar
      katto16
      Icon for Helper I rankHelper I

      I tried this and tested it by publishing it inside my own workspace, it worked. But when i published it inside the premium workspace, it didn't work. It was still UTC. Does it have smth to do with the premium workspace settings?