Forum Discussion
Set up a tile with last refresh date and time
I set up an autorefresh with an Excel file on my desktop as a data source
Date and time looked fine.
I guess if you're pulling the data from an online source that is located elsewhere then you may well have issues.
Had issues with all these approaches as I wanted the last refresh time to always be consistent and relatable for my viewers (i.e. put it in PST all the time). Wanted to make sure this was consistent - no matter if the update ran from PowerBI desktop or if via online Scheduled Refresh.
To bypass the issues with local time/server time via M - I found it easier to use the (awesome) web scraping capability of PowerBI to pull the data from a third party source.
Below are the steps and code to have a "Last Refresh Tile" that is "Last Refresh PST" (this can be whatever zone you want).
Steps:
1) Create a new blank query via "Get Data".
2) Once in the blank query, go to the Advanced Editor
3) Drop in the code below - overwriting the placeholder items in there. This will give you PST Time - so if you want something else, step through the query and you will see the options in the table for other zones.
let
// get the data from a stable source in table format from the web
Source = Web.Page(Web.Contents("http://www.timeanddate.com/worldclock/")),
//PowerBI does automatic detection
Data0 = Source{0}[Data],
#"Changed Type" = Table.TransformColumnTypes(Data0,{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}, {"Column6", type text}, {"Column7", type text}, {"Column8", type text}, {"Column9", type text}}),
//navigate to the column that has the time zone that is appropriate for the users of the dashboard (in this case, PST time zone Seattle)
#"Removed Other Columns" = Table.SelectColumns(#"Changed Type",{"Column8", "Column9"}),
//filtered the column to just have PST time shown (select whatever you require)
#"Filtered Rows" = Table.SelectRows(#"Removed Other Columns", each ([Column8] = "Seattle*")),
#"Removed Other Columns1" = Table.SelectColumns(#"Filtered Rows",{"Column9"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Other Columns1",{{"Column9", "Last Refresh (PST):"}})
in
#"Renamed Columns"
4) Close and Load - you will see a query with a column with the current PST time - "Last Refresh (PST)".
5) Once here, you can tweak your format and visualization - use a table for an easy first step.
6) Once up in your report, to enable automatic refresh, in settings for the dataset in PowerBI, use Anonymous as your credential for the website.
Done - no matter if you refresh from PowerBI desktop or via automatic refresh, it is "Last Refresh PST".
- wynhopkins10 years ago
Most Valuable Professional
Came across this on the Power BI Service
Click on the ... in a dashboard tiile
select the pencil to edit, and pick Display last refresh. Only works for Dashboards not reports though
- Anonymous8 years agoNot applicable
I have successully applied this to my dashboards. Thanks for the tip.
However pne dashboard does not give me the option of showing the last refresh data and time within "Edit details". Any ideas as to why?
- SurendraP8 years agoFrequent Visitor
Hi Virtual_Ames, your solution worked for me, thank you so much for this.
- R0ry7 years agoRegular Visitor