Scenario
We have a dashboard in our organization published on Power BI service which refreshes every hour and so the end user has ambiguity about the dashboard showing the latest data. So they can’t trust this data to show in leadership meetings, the end user doesn’t want to click anywhere in the app to see the refresh date & timestamp, so we want to show when was the dashboard refreshed in the report. It will be like the last refreshed x hours ago.
Step 1
Open .pbix file in Power BI Desktop
Go to - Transform Data - Power Query editor mode - New Source
Step 2
Click on Blank Query
Step 3
Add the below function to the query
= DateTime.LocalNow()
Select Convert to Table
Step 4
Make a duplicate of the Date time column
By select column - Transform - Date only for Date column & Time Only for Time column
Step 5
The final query looks like
Step 5
Close & apply the query
Calculate measure with below DAX,
Data Refreshed =
VAR _time =
NOW ()
RETURN
FORMAT ( MAX ( 'Date Refresh'[DateTime] ) - _time, "short time" ) & " ago"
Step 6
Add Multiline data card
Insert Data refreshed measure & Date column
Final O/p
Conclusion
We have added the date & timestamp in the report. When you’re going to publish in Power BI service this timestamp will auto-refresh by schedule refresh.
Thanks for reading
Happy Coding...!