Time of the last refresh

Two techniques for obtaining the PBI dataset’s last refresh time

Importance of the last refresh time

It is a good practice to include in your Power BI reports when was the last time the dataset got refreshed. There are several techniques for doing so.

Below, you will find two of them, both arriving to the same objective, a table with a single column containing a datetime field that updates every time the dataset refreshes.

World Time API

This is my favorite way of getting the last refresh time, because you do not have to deal with time zones adjustments. Only need to replace “Europe” for the continent we are interested in, and “Zurich” for the city.

Source = Json.Document(
RelativePath =
datetime = Source[datetime],
#"Converted to Table" = #table({"Last Refreshed Time"}, {{datetime}}),
#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Last Refreshed Time", type datetimezone}})
#"Changed Type"

If you are interested in further diving into the techniques used by this code, I recommend you visit the following blogs:

Chris Webb’s BI Blog: Using The RelativePath

BI Elite: Showing specific timezones

M Query

With a single line of code, we can get the latest UTC time.

Source = #table({"Last Refresh"}, {{DateTimeZone.UtcNow()}})

The result of this line of M code will be a table with a single row and column showing the UTC time, which is the coordinated universal time.

If we want to display the local time of the machine where this isbeing refreshed, we can also replace "DateTimeZone.UtcNow" for "DateTimeZone.LocalNow" but I would not recommend using this because you can get inconsistent times on what is displayed in the PBI desktop, and in the PBI service. Please see the image below of an example of datasets refreshed almost at the same time.

Consultant, Business Intelligence, data, and analytics.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store