Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
PBI_newuser
Post Prodigy
Post Prodigy

Last Refreshed Date for DirectQuery Datasets in Power BI

I have a report that pulls data from multiple Power BI datasets using DirectQuery. How can I create a measure or retrieve the last refreshed date for each dataset in the report?
 
1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @PBI_newuser 

 

Are you connecting to semantic models via direct query or connecting to databases via direct query? if the former, you will need to add a table that contains a column on when approximate the refresh happened. In DAX:

RefreshTable =
ROW ( "Refresh", UTCNOW () + DIVIDE ( 8, 24 ) )

Replace 8 with your UTC offset to create a single-row table that reflects your local time after all tables have been imported. Keep in mind that the Power BI service operates in UTC.

 

For direct query connections to databases, there is no reliable way to achieve this. You can use UTCNOW() + DIVIDE(8, 24) in a measure, but the value will change dynamically as users interact with the visuals. Since the result is cached, navigating back to a previous report state will revert to the earlier time.

 

If "datasets" refers to individual tables in a semantic model, it is not possible to achieve this. In direct query mode, data updates based on user interactions, so the closest approximation remains UTCNOW() + DIVIDE(8, 24).

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

5 REPLIES 5
danextian
Super User
Super User

Hi @PBI_newuser 

 

Are you connecting to semantic models via direct query or connecting to databases via direct query? if the former, you will need to add a table that contains a column on when approximate the refresh happened. In DAX:

RefreshTable =
ROW ( "Refresh", UTCNOW () + DIVIDE ( 8, 24 ) )

Replace 8 with your UTC offset to create a single-row table that reflects your local time after all tables have been imported. Keep in mind that the Power BI service operates in UTC.

 

For direct query connections to databases, there is no reliable way to achieve this. You can use UTCNOW() + DIVIDE(8, 24) in a measure, but the value will change dynamically as users interact with the visuals. Since the result is cached, navigating back to a previous report state will revert to the earlier time.

 

If "datasets" refers to individual tables in a semantic model, it is not possible to achieve this. In direct query mode, data updates based on user interactions, so the closest approximation remains UTCNOW() + DIVIDE(8, 24).

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian , a dataset refers to a semantic model. We are connecting to semantic models via direct query. We combined multiple semantic models into one report and now need to display the last refresh date for each semantic model. However, since some semantic models are not owned by me, creating a last refresh date column for each would require reaching out to individual report owners, which is time-consuming. Is there a way to create a measure within the report itself to capture the last refresh date of each semantic model?

I did mention using a measure in my previous reply but that is you're connected to several databases via direct query.

 

But you cannot rely on measures. NOW, TODAY and the likes are volatile. These measures will update as the user interacts with the visuals and revert to the previous value when a user reverts to the previous state of the report like undoing a slicer selection - this will only confuse the user. You'd want a value that is stored in the memory and will not update until the next refresh.

 

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.
rajendraongole1
Super User
Super User

Hi @PBI_newuser -

If the datasets you're querying include a last refreshed timestamp column or measure, you can pull that directly into your report. For example:

Check if each dataset has a table or measure containing a last refreshed date, such as [Last Refresh Date].
Add this to your report as a column, card, or table.

 

Eg: Last Refresh Date = NOW() // Returns the current date/time of the refresh

 

Hope this helps.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi @rajendraongole1 , there is no "Last Refresh Date" column available in the dataset. Since I pulled data from more than 10 datasets into a single report, do I need to go back to each dataset to create a "Last Refresh Date" field, or is there a more efficient way to retrieve the last refresh date in the DirectQuery report?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.