Microsoft Certified Power Bi Data Analyst Associate · Free Practice Question Medium
Question 5
You are working on a Power BI report that uses a data source file stored on a network drive. After publishing the report to the Power BI service, the scheduled data refresh fails, showing the following error:
Datasource.Error: Could not find file.
What steps should you take to resolve this issue?
-
A
Update the file path in Power Query to use a fully qualified UNC path instead of a mapped drive letter.
-
B
Move the file to a local drive on your computer and reconnect Power BI to the file.
Reveal correct answer
Correct answer: A
Explanation
The most effective way to resolve this issue is to ensure the file path is universally accessible in a format that the Power BI Service can understand. Here’s how to do it:
Update the File Path in Power Query to Use a Fully Qualified UNC Path
Instead of relying on a mapped drive letter (e.g., Z:\data\file.xlsx), update the file path to use a Universal Naming Convention (UNC) path (e.g., \\servername\sharename\data\file.xlsx). A UNC path specifies the full network location of the file, including the server and share name, which is independent of local drive mappings.In Power BI Desktop, open the Power Query Editor by selecting "Transform Data."
Locate the query that connects to the file (e.g., in the "Applied Steps" pane, look for the "Source" step).
Edit the source step to replace the mapped drive path with the UNC path. For example, change File.Contents("Z:\data\file.xlsx") to File.Contents("\\servername\sharename\data\file.xlsx").
Apply the changes and save the report.
According to the Microsoft documentation on connecting to files in Power BI, "When using files on network drives, it’s recommended to use UNC paths to ensure compatibility with the Power BI Service, as mapped drive letters are not recognized in the cloud."
Verify Network Accessibility and Credentials
After updating the path, ensure that the file’s location (the network share) is accessible to the Power BI Service. This requires configuring a data gateway because the Power BI Service cannot directly access on-premises network drives without one.Install and configure an On-premises Data Gateway on a machine that has access to the network drive (e.g., a server or workstation on the same network).
In the Power BI Service, go to "Manage Gateways" under settings, add the data source (using the UNC path), and provide credentials for accessing the network share (e.g., a domain account with read permissions).
Link the dataset to the gateway in the dataset settings and schedule the refresh.
The Microsoft documentation on configuring data refresh with gateways states, "For on-premises data sources like files on a network share, a gateway is required to enable scheduled refresh in the Power BI Service."
Republish the Report and Test the Refresh
After updating the file path and configuring the gateway, republish the report to the Power BI Service from Power BI Desktop. Then, in the dataset settings, confirm the data source credentials are correctly set and test the scheduled refresh to ensure it succeeds without the "Could not find file" error.
Why Not Move the File to a Local Drive?
Moving the file to a local drive on your computer (e.g., C:\data\file.xlsx) and reconnecting Power BI might work in Power BI Desktop, but it doesn’t solve the refresh issue in the Power BI Service. The service still cannot access your local machine’s drives without a gateway, and using a local path introduces the same accessibility problem as a mapped drive. Additionally, this approach is impractical for collaboration or shared access, as the file would be tied to a single machine. The Microsoft guidance on data refresh troubleshooting warns against relying on local paths for cloud-based refreshes, reinforcing the need for a network-accessible solution.
A.
Mapped drive letters (e.g., Z:\Data\File.xlsx) are specific to the user’s local computer and are not accessible by the Power BI service or the data gateway. Changing the path to a fully qualified UNC path (e.g., \\ServerName\SharedFolder\Data\File.xlsx) ensures the file can be accessed during a scheduled refresh.
B.
Moving the file to a local drive on your computer (e.g., C:\data\file.xlsx) and reconnecting Power BI might work in Power BI Desktop, but it doesn’t solve the refresh issue in the Power BI Service. The service still cannot access your local machine’s drives without a gateway, and using a local path introduces the same accessibility problem as a mapped drive.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
