Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
Hi,
I want to create a Power Query Formula, which uses a Parameter that my users can manipulate called as Time Zone. The Parameter type for #Time Zone is decimal right now so it can accept positive & negative values with decimal points.
I have a 'datetime' column called Time in (UTC). I want to create a Power Query formula such that I can pass the parameter #Time Zone which would convert Time (UTC) column to match that time zone and update the values in the column.
Eg: if UTC datetime value is
| 8/20/2020 14:10:15 UTC |
and my #Time Zone is +5.5 (5:30 mins) then above value should change to 8/20/2020 7:40:15 PM (8/20/2020 19:40:15 IST)
or if my #Time Zone is -5 (5:00 ) then my time value should change to 8/20/2020 9:10:15 AM (8/20/2020 09:10:15 ET)
I may have to change the datatype of my #Time Zone parameter from decimal to time or duration according to soultion which is fine but I would prefer in Decimal.
@Icey
The solution Jimmy provided is helpful in providing me direction but id dint solve the problem for me yet. I'm exploring another solution and will udpate here once I have the answer.
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
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