Forum Discussion
Suddenly wrong dates in PowerBI
- 7 months ago
synaptical Hey,
Try below steps too. I believe you are very close solve this issue.1) Where to inspect the “JSON”/raw timezone in Power Query
- With the standard “SharePoint Online List” connector you won’t see literal JSON like ...T23:00:00Z inside the Source/Navigation step; Power Query materializes values into types (date/datetime/datetimezone).
- Quick way to check the actual timezone:
- In Power Query Editor, Add Column > Custom Column
- Name: CheckZone
- Formula:
- If your column is Start:
- try DateTimeZone.ToText([Start]) otherwise try DateTime.ToText([Start]) otherwise [Start]
- This will show whether values include an offset (e.g., +00:00, +01:00). If you consistently see +00:00 or values that resolve to UTC midnight, you likely have a UTC-write issue from Flow.Tip: If you absolutely need to see literal JSON from SharePoint, you’d use Web.Contents against the REST API (advanced), but for 99% of BI scenarios, the text conversion above is enough to reveal the timezone/offset being carried.
2) Why your colleague sees the “right” date
- They likely:
- Cast to Date immediately (dropping time and timezone) OR
- Use Date.From on a UTC-normalized value OR
- Use a different connector/step ordering that normalizes UTC before dropping the time.- The key is to normalize first, then drop the time, and to do it early in the query (right after Navigation).
3) Plug‑and‑play fixes (add one of these right after “Navigation”)
Pick the one that matches your situation. Replace "Start" with your actual column name. If you have multiple date columns, apply the transform to each.A) If Flow wrote Date-only as UTC midnight (classic cause of “previous day” in local time)
- Normalize to UTC, then drop time:
- #"Fix dates (UTC)" = Table.TransformColumns(#"Navigation", {{"Start", each Date.From(DateTimeZone.SwitchZone(_, 0)), type date}})Result: A value like 2026-01-16T00:00:00Z will become date 2026-01-16, regardless of your local offset.
B) If values are true local datetimes and you just want the local date
- Convert to local time, then drop time:
- #"Fix dates (Local)" = Table.TransformColumns(#"Navigation", {{"Start", each Date.From(DateTimeZone.ToLocal(_)), type date}})C) If the column type varies (datetimezone/datetime/text) — robust one-liner
- Handles mixed types and casts to date:
- let
FixDate = (v as any) as date =>
if Value.Is(v, type datetimezone) then Date.From(DateTimeZone.ToLocal(v))
else if Value.Is(v, type datetime) then Date.From(v)
else if Value.Is(v, type date) then v
else if Value.Is(v, type text) then Date.From(DateTime.FromText(v))
else try Date.From(v) otherwise null,
#"Fixed Start" = Table.TransformColumns(#"Navigation", {{"Start", FixDate, type date}})
in
#"Fixed Start"Swap DateTimeZone.ToLocal(v) for Date.From(DateTimeZone.SwitchZone(v, 0)) if you confirmed a UTC-write scenario and need to keep the intended date.
4) Exactly where to put the step
- Home > Transform Data > Power Query Editor
- View > Advanced Editor
- Find the line with #"Navigation" = ... (or the last step that yields your table)
- Directly after that, add one of the transforms above
- If you already have a #"Changed Type" step, insert the fix before Changed Type, or update Changed Type to set type date for your column
Example full snippet (edit names as needed):
- let
Source = SharePoint.Tables("https://yourtenant.sharepoint.com/sites/yoursite", [Implementation="2.0"]),
#"Navigation" = Source{[Name="YourListName"]}[Items],
// Fix: normalize to UTC then cast to date
#"Fix dates (UTC)" = Table.TransformColumns(#"Navigation", {{"Start", each Date.From(DateTimeZone.SwitchZone(_, 0)), type date}})
in
#"Fix dates (UTC)"5) Quick validation
- After the fix, show Start as type date and compare a few rows to what SharePoint shows for “Date only”.
- If you still see an off-by-one day, switch between the UTC and Local versions and recheck.
6) Common pitfalls checklist
- Don’t convert to Date after time-zone conversion that shifts across midnight unless you intend that shift.
- Apply the fix early (right after Navigation) so merges/joins and type changes operate on correct dates.
- Ensure you are using the “SharePoint Online List” connector (not “SharePoint Folder” or a custom Web.Contents) to match your colleague’s setup.
Thanks
Haish K
If I resolve your issue. Kindly give kudos to this post and accept it as a solution so other can refer this.
Thank you so much for your reply again and sorry for my late anwser as I was offline for several days.
I think I understood your suggestions and approach. If I enter one of the fixes proposed above, by replacing "Start" with my actual column name, I get a
Expression.SyntaxError: Token ',' expected
error.
I also cannot find a #Navigation step in my file (I connect via SharePoint List, not SharePoint Online).
I exchanged "Start" with my actual column name and #Nagivation by a alphanumeric ID as I do not see a Navigation entry in Power Query.
When first time connecting to the sharepoint list, my initial view in advanced editor looks like this:
Do you have a tip what I need to adjust?
synaptical Hey,
The “Expression.SyntaxError: Token ‘,’ expected” error in Power Query (M) almost always means there’s a small syntax issue in the let block (missing comma, missing parenthesis/brace, or an unclosed quote), not necessarily a problem with the column name itself.
Key things to check when you edit the query:
- Every step inside let must end with a comma, except the last line referenced in the in.
- Step names with spaces or special characters must be written as #"Step Name".
- Column names used as text parameters (like in Table.TransformColumnTypes) must be quoted, e.g. {"Start Date", type datetime}.
- Column references inside an each expression must use [Column Name] without quotes, e.g. [Start Date].
- If you removed/renamed a step (like #"Navigation"), update all later references to use the new step name.
- Make sure all parentheses (), braces {}, brackets [], and quotes " are properly closed.
You can refer this sample steps for your requirement.
let
Source = SharePoint.Lists("https://yourtenant.sharepoint.com/sites/YourSite", [ApiVersion = 15]),
ListItems = Source{[Name = "Your List Display Name"]}[Items],
#"Changed Type" = Table.TransformColumnTypes(
ListItems,
{
{"Start Date", type datetime},
{"End Date", type datetime}
}
),
#"Added Duration (Minutes)" = Table.AddColumn(
#"Changed Type",
"Duration Minutes",
each Duration.TotalMinutes([End Date] - [Start Date]),
type number
)
in
#"Added Duration (Minutes)"Thanks
Haish K
If I resolve your issue. Kindly give kudos to this post and accept it as a solution so other can refer this.