Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 213819

Easy consistent Last Refresh Time (your local time zone) solution - no matter how refreshed

$
0
0

If you want to make sure your viewers know how fresh the data in a report is - you may want to have a "Last Refreshed" tile showing.  The challenge is - if you publish from your desktop, you get last published in your local time, and if you run a scheduled refresh, you get the last published in the a completely different time zone (local to the server).  This can be confusing to the users of the dashboard.  

 

One solution is to put this into a consistent and relatable time zone for the viewers - in this example, "Last Refresh" will now be set to "Last Refresh PST". 

 

To bypass the issues with local time/server time via M - this can be solved using the (yes, pretty 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" in PowerBI desktop.

 

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".


Viewing all articles
Browse latest Browse all 213819

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>