Simple Power Query M to Display When the Report was Last Refreshed

Very simple query to show when you last hit the 'Refresh' button in PowerBI wrote this about 5 years ago and it was last updated about 5 years ago.

← Back to the Posts

I have a habit of hitting the 'Refresh' button then forgetting and not being able to tell when I last hit it. Stupid right. Only a fool would refresh a report straight after they just refreshed it in the hope of not accidentally uploading old data to the Power BI App Workspace.

I am probably missing something super obvious in the UI but just in case I load this query called LastUpdatedAt into the PowerBI Report and link it to a text box.

// LastUpdatedAt
    Source = DateTime.LocalNow()

Now the format of the query is in Power Query M Time format so I convert it to something more human readable by either inserting a measure or creating a new column on the query with the following DAX.

  Measure = "Last Updated on " & FORMAT(MAX(LastUpdatedAt[LastUpdatedAt]),"d/MM/yy at HH:mm:ss")

You can then drop the new Measure onto a text box visual to display Last Updated on 17/05/2017 at 14:11:12. Yay!

Other Thoughts

You could expand this pattern and called the query something like TimeFunctions and attach all sorts of other measures to this query that can be used in your DAX formulas or displayed in other areas of your report.

I have added some functions like

  DaysThisFinancialYear = DATEDIFF(DATE(YEAR(TODAY()),7,1),DATE(YEAR(TODAY())+1,7,1)-1,DAY)+1
  LastDayOfThisMonth = FORMAT(EOMONTH(TODAY(),0),"DD")

I have other Date and Time functions in my cheatsheet over at Ceatsheet for DAX Date and Time Functions