Forum Discussion

Manikanta2108's avatar
1 year ago
Solved

Last Data refresh Date

Instead of publish,semantic refresh date. i need to show date for latest changes of datasource in dashboard. How can i do it ?
  • Cookistador's avatar
    1 year ago

    Hi Manikanta2108 

     

    In power query, you create a new blank query, then you click on advanced editor  in the home ribbon and you paste this code instead of the source one:

    let
        Source = DateTime.LocalNow()
    in
        Source

    Then you just have to convert it to a table:

    Rename the query with something like LastRereshDate, close and apply and now, you are able to get the last refresh date  in your report

     

    If you prefer, you can also create a table in DAX and use the NOW() function but you have to create a calculated column, if you use it with a measure, each time you open the report, the date will be updated

     

  • danextian's avatar
    1 year ago

    Hi Manikanta2108 

     

    Create a blank query with the following script.

    let
        Source = DateTimeZone.SwitchZone(DateTimeZone.UtcNow(),8),
        #"Converted to Table" = #table(1, {{Source}}),
        #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Date"}}),
        #"Changed Type" = Table.TransformColumnTypes(#"Renamed Columns",{{"Date", type datetime}})
    in
        #"Changed Type"

    Replace  8 with your actual GMT offset. My timezone is GMT+8. This approach takes into consideration that you  will be refreshing the semantic model in the service which uses GMT and thus the need to to use DateTimeZone.UtcNow() and then convert it to the local timezone. Please note that Power BI  doesn't have a built-in function to check for daylight savings.

    If you're referring to when your data itself upon refresh, it depends on the data source. You can use the latest timestamps in the data or if flat files saved in sharepoint the creation or modified date.