Skip to content

Latest commit

 

History

History
85 lines (58 loc) · 2.92 KB

add-last-refresh-time.md

File metadata and controls

85 lines (58 loc) · 2.92 KB
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

Create a column in Power BI for last refresh date

[!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]

Add the last refresh date column

To add a column with the last refresh date of the dataset, follow these steps.

  1. Load the Power BI pbix file associated with your view in Power BI Desktop.

  2. In the External Data section of the ribbon, choose Edit Queries.

    [!div class="mx-imgBorder"]
    Power BI Desktop, Home tab, Edit Queries

  3. Open Advanced Editor.

    [!div class="mx-imgBorder"]
    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.

  4. When finish, choose Done.

  5. Choose Close & Apply to immediately refresh the dataset.

    [!div class="mx-imgBorder"]
    Power BI Desktop, Home, Close & Apply

  6. Identify the Refresh Date column under the field.

    [!div class="mx-imgBorder"]
    Power BI Desktop, Fields, Refresh Date field

  7. Add the field to a card to see the last refresh date on your reports.

    [!div class="mx-imgBorder"]
    Power BI Desktop, Card, Refresh Date Applied

Related articles