Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hey Everybody,
I am having trouble with my M-code. I am creating a timestamp to use in the cloud that shows the refresh time for Power BI reports.
Here is my M-code.
let
SummerTime = Date.StartOfWeek(#date(Date.Year(DateTime.LocalNow()),3,14), Day.Sunday),
WinterTime = Date.StartOfWeek(#date(Date.Year(DateTime.LocalNow()),10,14), Day.Sunday),
CurrentDateTime = DateTimeZone.RemoveZone(DateTimeZone.UtcNow()),
TimeShiftFromUTC = if CurrentDateTime < SummerTime & #time(1, 0, 0) or
CurrentDateTime > WinterTime & #time(1, 0, 0) then
1 else 2,
TimeStamp = DateTimeZone.SwitchZone( DateTimeZone.UtcNow(), TimeShiftFromUTC, 0),
#"Converted to Table" = #table(1, {{TimeStamp}}),
#"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Time Stamp"}}),
#"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Time Stamp", type datetimezone}})
in
#"Changed Type"
Here is my output.
Currently, I am in Chicago, and the time should have read 12:46:51 PM. However, I want the time to be in EST. Consequently, the above output should be 1:46:51 PM (if everything is correct).
Can anyone give me help with my above M-code so that it works all year round?
Thanks
Dan
Solved! Go to Solution.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.