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.

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.

let
Source = Json.Document(
Web.Contents(
"http://worldtimeapi.org/api/timezone/",
[
RelativePath =
"/Europe"&
"/Zurich"
]
)
),
datetime = Source[datetime],
#"Converted to Table" = #table({"Last Refreshed Time"}, {{datetime}}),
#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"Last Refreshed Time", type datetimezone}})
in
#"Changed Type"

M Query

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

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

Consultant, Business Intelligence, data, and analytics.