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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Jim_
Advocate I
Advocate I

DataSource.Error: Could not find file...

When I refresh a project I am working on I get the error listed above.  I can navigate to the file and open it.  Is there any known reason that BI would lose the ability to connect to a file?

 

 

1 ACCEPTED SOLUTION
v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @Jim_,

Please click the file->Options and Settings->Data Source Settings, you will get the following data source settings navigator. Then select change source(highlighted in red line), please check the path and open file as right format.

3.png

what's your data soure? I post an example using .xls file above. Please check if it works fine. Please share more details if you have still find other issue.

Thanks,
Angelia

View solution in original post

10 REPLIES 10
mtnbkr0918
New Member

This issue can happen when your data files are pointing to the root folder and your primary file is saved to a subfolder. Either move the data files or move your primary file one level above. 

Anonymous
Not applicable

Does anyone have insights into the M function that can be implemented to handle the non-existence of a file being used as a data source?  I am building a report template that will be used for multiple data sets, and some files will occassionally be missing, so I'm trying to implement a solution that can handle this scenario.  Table.IsEmpty does not resolve the issue, since there is no empty table.

You can wrap anything in M with a "try <whatever you are trying to do> otherwise <do something else>"

 

Not exactly sure how to implement in your situation, but maybe there is a way to have PBI ignore the cases where the file is missing (and throws and error).

Anonymous
Not applicable

You just answered the question for me, thank You.

The way to fully enanble this is to add another last step where you ask M if the Source is equal to the otherwise statement and substitute it for the last previous step if it isn't.

Anonymous
Not applicable

Thanks for the quick reply.  I'm including parameters for the root folder (i.e. full data set), and the below file ('filename.csv') won't always be present in the data sets, so I'm looking for an alternative to disabling this query when the file is missing since that would cause all my measures to disappear in my template.   Any solution that would allow the other queries to run successfully would work for me, as the end user will just delete the tabs in the report that pull from this source.

 

Source= Csv.Document(File.Contents(#Source & "\filename.csv"),[Delimiter=",", Columns=11, Encoding=1252, QuoteStyle=QuoteStyle.None])

v-huizhn-msft
Microsoft Employee
Microsoft Employee

Hi @Jim_,

Please click the file->Options and Settings->Data Source Settings, you will get the following data source settings navigator. Then select change source(highlighted in red line), please check the path and open file as right format.

3.png

what's your data soure? I post an example using .xls file above. Please check if it works fine. Please share more details if you have still find other issue.

Thanks,
Angelia

Anonymous
Not applicable

I have this problem too. The issue seems to be there is no .pbix file option for file type:

jgscott3_0-1605578550735.png

 

Hi @Anonymous 

Just replied to you here https://community.powerbi.com/t5/Power-Query/No-pbix-option-in-quot-Open-file-as-quot-dialog/m-p/1497695#M46604

Regards

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


I did check this and it was correct, however I tried browsing to the file again and that seemed to work.

 

Thanks!!!

dkay84_PowerBI
Microsoft Employee
Microsoft Employee

Can you post a screenshot of the formula bar for the Source step?  Make sure the file paths match and the Source step includes the full file path (i.e. the ".xlsx" for excel, not just the folder location)

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.