title | titleSuffix | description | ms.subservice | ms.author | author | ms.topic | monikerRange | ms.date |
---|---|---|---|---|---|---|---|---|
Add last refresh date to a Power BI report |
Azure DevOps |
Learn how to add a field showing the last refresh date to an existing Power BI report based on Analytics. |
azure-devops-analytics |
kaelli |
KathrynEE |
how-to |
>= azure-devops-2019 |
10/01/2021 |
[!INCLUDE version-gt-eq-2019]
After creating a report and publishing it to Power BI, one of the most common requests is a way to determine the last time the data was refreshed.
[!INCLUDE temp]
To add a column with the last refresh date of the dataset, follow these steps.
-
Load the Power BI pbix file associated with your view in Power BI Desktop.
-
In the External Data section of the ribbon, choose Edit Queries.
-
Open Advanced Editor.
If you haven't already modified the query, you should see text below with specific table values matching your Analytics view.
let Source = VSTS.AnalyticsViews("{OrganizationName}", "{ProjectName}", null), #"{tableid}_Table" = Source{[Id="{tableid}",Kind="Table"]}[Data], in #"{tableid}_Table"
Modify the query as follows:
let Source = VSTS.AnalyticsViews("account", "project", null), #"{tableid}_Table" = Source{[Id="{tableid}",Kind="Table"]}[Data], #"Added Refresh Date" = Table.AddColumn(#"{tableid}_Table", "Refresh Date", each DateTimeZone.FixedUtcNow(), type datetimezone) in #"Added Refresh Date"
[!IMPORTANT]
These examples use UTC. You can adjust the query code based on your specific timezone as described in DateTimeZone functions. -
When finish, choose Done.
-
Choose Close & Apply to immediately refresh the dataset.
-
Identify the Refresh Date column under the field.
-
Add the field to a card to see the last refresh date on your reports.