Forum Discussion
How to Automatically Name the Query with a Date Stamp from the Date of Refresh
- 5 years ago
You cannot. Query names are part of the metadata and neither DAX nor Power Query can touch those, and Power Query cannot generate new queries dynamically like this.
You would need to add this information as part of a field within the query.
No, you cannot do that either. The issue is when you refresh, everything refreshes, so you get 1 date for all refreshed data. It will not keep track of what you did last week vs this week. The right way to do that is to add the "data date" to the source data. If it were Excel files for example, you could use the "last saved date" from the file, But even that might not be correct if someone opened and saved, without changing data, a 3 week old file. It would have today's date.
There is an interesting hack for this in this article by tricking Power BI into thinking it is an incremental refresh, but I would not recommend it for a production environment. If you updated your data and republished your file, all of your historical dates would get trashed unless you used ALM Toolkit to preserve and change the dates back.
Chris Webb's BI Blog: Incremental Refresh Chris Webb's BI Blog (crossjoin.co.uk)
But if the source data had the data date, then it would just always work.
Remember, Power BI when it refreshes (other than legit Incremental Refresh) it essentially deletes the entire data model and reloads it from scratch. And even with true incremental refresh, it isn't retaining refresh dates like you are envisioning. It is just partitioning the data so it can save time on large data model refreshes.