Forum Discussion
Report Refresh Time always Wrong
- 3 months ago
Hello ArchStanton,
Thank you for sharing the screenshot.The error occurs because in Power Query, each line must be added as a new step inside the let in block, with the previous step ending in a comma. If the new line is entered by itself in the formula bar, Power Query tries to evaluate AdjustedDateTime before it exists.
Please update your query like this Add the new step after AsDateTime:
let Source = DateTimeZone.UtcNow(), UKTime = DateTimeZone.SwitchZone(Source, 0, 0), UKAdjusted = DateTimeZone.ToLocal(Source), AsDateTime = DateTimeZone.RemoveZone(UKAdjusted), AdjustedDateTime = AsDateTime + #duration(0, 1, 0, 0), AsTable = #table(1, {{AdjustedDateTime}}), RenamedCols = Table.RenameColumns(AsTable, {{"Column1", "DateTime"}}), ChangedType = Table.TransformColumnTypes(RenamedCols, {{"DateTime", type datetime}}), WithDate = Table.AddColumn(ChangedType, "Date", each DateTime.Date([DateTime]), type date), WithTime = Table.AddColumn(WithDate, "Time", each DateTime.Time([DateTime]), type time) in WithTimePower Query steps work sequentially, so the new step must be part of the query and referenced later in AsTable.
Please try the above structure and let me know how it goes.
Best regards,
Ganesh Singamshetty
Try using this instead:
let
Source = DateTimeZone.UtcNow(),
UKTime = DateTimeZone.SwitchZone( Source, 0, 0 ),
UKAdjusted = DateTimeZone.ToLocal( Source ),
AsDateTime = DateTimeZone.RemoveZone( UKAdjusted ),
AsTable = #table( 1, {{ AsDateTime }} ),
RenamedCols = Table.RenameColumns( AsTable, {{"Column1", "DateTime"}} ),
ChangedType = Table.TransformColumnTypes( RenamedCols, {{"DateTime", type datetime}} ),
WithDate = Table.AddColumn( ChangedType, "Date", each DateTime.Date( [DateTime] ), type date ),
WithTime = Table.AddColumn( WithDate, "Time", each DateTime.Time( [DateTime] ), type time )
in
WithTimeThanks for this, I've just updated it with your code - lets see what happens.
Last night, after the edit that I made which I mentioned above, the report said it refreshed at 23:55:
but the actual refreshed time in service says 02:56 despite me having it scheduled for 01:30:
Scheduled refresh time:
Its such a mess, nothing is aligned, hopefully your fix will work, I'll try it to today.