Forum Discussion
How do I make my Power Query formula accept timezone with decimal points
Hello newpi
You can use the function DateTimeZone.SwitchZone to accomplish this. This accepts a number to switch the zone. In case you want to use another format afterwards, you could create a function where you manipulate the format, before passing it to the function DateTimeZone.SwitchZone. Here the code
let
Source = #table
(
{"TimeZoneUTC"},
{{DateTimeZone.FixedUtcNow()}}
),
Add= Table.AddColumn
(
Source,
"Your time",
each DateTimeZone.SwitchZone([TimeZoneUTC],5.5)
)
in
Add
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Jimmy801 I want to use a parameter here and my parameter name is "#Time Zone" .
I do not want to add column as there are dependant columns to my existing one, so want to edit my formula there itself. My current formula is :
The above formula is working fine when #Time Zone Parameter is whole number like 5 but not working when its a decimal like 5.5
- Jimmy8016 years agoCommunity Champion
Hello newpi
then change the formula to this
= if #"Daylight Savings" = true then DateTimeZone.SwitchZone([#"Activity Time (UTC)"],#"Time Zone" +1) else DateTimeZone.SwitchZone([#"Activity Time (UTC)"],#"Time Zone")
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy