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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
JohDoe
New Member

Query to fetch data based on date

Hi,

 

Pretty new to PowerBI and I would need some assistance.

 

I need to query data from an Excel file, based on the folder & file name.

 

I have a folder X, which has yearly folders inside, those yearly folders have monthly folders and those monthly folders have daily generating  excel-files for every businessday.

 

Now I would need to query data from static cells based on the date. So for example I generated a new Excelfile yesterday which is located and named like below:

JohDoe_0-1703004062782.png

 

I have a time series taking just 2 values from those daily Excelfiles from static cells. How can I automate the query to fetch yesterdays data automatically based on todays date? I.e. automatically updating query based on todays date, and if there is not a daily file for yesterday, skip the query (holidays & weekends).

 

I create new folders & files to those folders as time goes on on a daily basis, but would like the PowerBI to be automatic.

Any examples or tips are welcome on how to get started with this, thanks!

1 REPLY 1
lbendlin
Super User
Super User

I have a folder X

Don't do that - it will require a gateway.  Instead, place your files on a SharePoint / OneDrive and then use the "Sharepoint Folder"  connector.  That will allow you to dynamically identify the required Excel file and then pull the data from there.   "Skip the query"  is not a thing, you MUST return something at the end of the Power Query - you could either return the latest available data, or a placeholder.

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.