cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Jim_ Regular Visitor
Regular Visitor

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

Accepted Solutions
v-huizhn-msft Super Contributor
Super Contributor

Re: DataSource.Error: Could not find file...

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

7 REPLIES 7
dkay84_PowerBI New Contributor
New Contributor

Re: DataSource.Error: Could not find file...

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)

v-huizhn-msft Super Contributor
Super Contributor

Re: DataSource.Error: Could not find file...

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

Jim_ Regular Visitor
Regular Visitor

Re: DataSource.Error: Could not find file...

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

 

Thanks!!!

brandonjudge Regular Visitor
Regular Visitor

Re: DataSource.Error: Could not find file...

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.

dkay84_PowerBI New Contributor
New Contributor

Re: DataSource.Error: Could not find file...

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).

brandonjudge Regular Visitor
Regular Visitor

Re: DataSource.Error: Could not find file...

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])

vaidotasivoska Frequent Visitor
Frequent Visitor

Re: DataSource.Error: Could not find file...

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.

Helpful resources

Announcements
Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Summit North America

Power Platform Summit North America

Register by September 5 to save $200

PBI Community Highlights

PBI Community Highlights

Check out what's new in the Power BI Community!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Top Kudoed Authors
Users Online
Currently online: 391 members 3,564 guests
Please welcome our newest community members: