Display the Last Refreshed Date in Power BI
Generate Last Refreshed Date with Power Query
Unlike the previous article, to work with Power BI, we need to generate the Last Refresh date ourselves using Power Query. No big deal, it is as simple as this:
Open PowerBI Desktop
Get Data –-> Blank Query
Go to Home –> Advanced Editor and replace the code in the window with this:
let
Source = #table(type table[LastRefresh=datetime], {{DateTime.LocalNow()}})
in
Source
Click Done and rename the query “LastRefresh_Local”
Click Close & Apply
This code makes a nice little table that returns the current date and time each time we refresh the solution.
Create the Last Refreshed Measure
To finish it off, we need to create a simple measure and add it to our dashboard.
Go to your Report window –> New Measure –> Define it as follows:
Last Refreshed (Local) = FORMAT(LASTDATE(LastRefresh_Local[LastRefresh]),"mmm dd, yyyy hh:mm:ss AM/PM")
Now let’s create a Card visual to hold it: