power bi last refresh date on report code example
Example: Power BI add last refreshed time to report
1. On the Query Editor window, from the Home ribbon, click on the New Source option.
2. Next, select Blank Query.
3. Under the Queries section, right-click on the newly created Query1 (1) and select Rename (2).
(In this example, I renamed the query to Date Last Refreshed.)
4. Now click on the Advanced Editor option, from the Home ribbon, and paste the M code (see below):
let
Source = #table(type table[Date Last Refreshed=datetime], {{DateTime.LocalNow()}})
in
Source
4. The M code creates a column with the name Date Last Refreshed and it gathers the current date
and time.
5. Add the column to a card visual and ensure that it uses the "Latest" value