Refresh Date not working when Published

Hi I have a Latest refresh Date table (M code below)

This updates fine in Power BI Desktop, but when it is published it does not update when a scheduled refresh runs from the Workspace, despite all other data updating.

At first I thought it was because I used it in the Text field as a value, but even if I replace it with a Table field, it does not work. Has anyone else encountered this and do you have a solution?

M Code:

let
Source = DateTime.LocalNow(),
#“Converted to Table” = #table(1, {{Source}}),
#“Renamed Columns” = Table.RenameColumns(#“Converted to Table”,{{“Column1”, “DateTime”}}),
#“Duplicated Column” = Table.DuplicateColumn(#“Renamed Columns”, “DateTime”, “DateTime - Copy”),
#“Changed Type” = Table.TransformColumnTypes(#“Duplicated Column”,{{“DateTime - Copy”, type date}}),
#“Duplicated Column1” = Table.DuplicateColumn(#“Changed Type”, “DateTime”, “DateTime - Copy.1”),
#“Changed Type1” = Table.TransformColumnTypes(#“Duplicated Column1”,{{“DateTime - Copy.1”, type time}}),
#“Renamed Columns1” = Table.RenameColumns(#“Changed Type1”,{{“DateTime - Copy”, “Date”}, {“DateTime - Copy.1”, “Time”}})
in
#“Renamed Columns1”

I believe there are several postings concerning this issue on the forum. right now i don’t have time to search the forum…Please search the forum

Power Query also has Refresh Enabled on the table just as an update.

@ Keith from Finance - I didn’t find anything on the forum about this specific issue other than adding the latest refresh date and I checked more than one place before I came here for a solution, but thanks for your feedback.

Check youtube and the courses on edna. there might be something there

It wasn’t Power BI failing to refresh, it was the Browser.

Pressing CTRL + F5 to bypass the cache fixed my issue. The date updated in the report.

Hi @lavina.bogan ,

I have attached a text file containing the various bits of M code and DAX to create a Last Updated value for Power BI service reports, including handling DST for many time zones. The value will be updated each time the dataset is refreshed.

Once the pieces are set up, you just add a text box visual to display the DAX “LastUpdated” value. Note that the time value is when the refresh completed.

The text box value displaying the DAX function result appears like this in my report (I’m in the US, EST):
image

LastRefreshDateTime.pq (3.0 KB)

John

1 Like

I am trying to use your function for last refresh date but I am getting a token end of file expected error in the following location:

Any idea how to fix this?

Hi @michael.wescott7226,

The code file actually contains multiple chunks of M and DAX code that should be copied separately to their target query editor. I kept them in one file to make it easier to get all the pieces at once. Best to open that in Notepad or a text editor, then copy the respective pieces you need.

You can see the comments I included for “End table definition” (that’s the end of the M code script to create the table), and for “Begin function definition…” (that’s the start of the M code for the function that converts the date). The DAX function to display the Last Updated value is below all that.

Just copy the code between each Begin/End set of comments and you’ll be all set!

Happy Holidays!

John