Forum Discussion
Wrong date values after publishing report
Anyone found the solution for this issue?
- Numan_Dev9 months agoFrequent Visitor
Hi Satya2277 ,
since it was one year ago, I am not sure if this was the solution, but maybe this helps:
In the Query Editor, create a column that converts the datimetzone columns to your specific timezone:= Table.AddColumn(#"...", "date_local", each GetGermanTime(DateTime.AddZone([date], 0)), type datetimezone)
I created this "GetGermanTime" function to calculate the german timezone value, also considering the timezone changes between summer and winter time:
= (InputDateTime as nullable datetimezone) as nullable datetimezone =>
let
// Prüfen, ob der Eingabewert null ist
Result = if InputDateTime = null then
null
else
let
// Jahr aus dem Eingabewert extrahieren
CurrentYear = Date.Year(InputDateTime),
// Sommerzeit Start: Letzter Sonntag im März
StartDST = Date.AddDays(#date(CurrentYear, 3, 31), -(Date.DayOfWeek(#date(CurrentYear, 3, 31), Day.Sunday))),
StartDSTDateTime = #datetimezone(CurrentYear, Date.Month(StartDST), Date.Day(StartDST), 2, 0, 0, 0, 0),
// Sommerzeit Ende: Letzter Sonntag im Oktober
EndDST = Date.AddDays(#date(CurrentYear, 10, 31), -(Date.DayOfWeek(#date(CurrentYear, 10, 31), Day.Sunday))),
EndDSTDateTime = #datetimezone(CurrentYear, Date.Month(EndDST), Date.Day(EndDST), 2, 0, 0, 0, 0),
// Prüfen, ob Sommerzeit
IsDST = InputDateTime >= StartDSTDateTime and InputDateTime < EndDSTDateTime,
// Umwandlung in deutsche Zeit
GermanTime = if IsDST then DateTimeZone.SwitchZone(InputDateTime, 2) else DateTimeZone.SwitchZone(InputDateTime, 1)
in
GermanTime
in
Result