Yes, you can update a file path in Power BI Desktop or the Power BI Service, but the method depends on whether you are using the desktop app or a published report. In Power BI Desktop, you change the source in the Data Source Settings. In the Power BI Service, you must update the source in the desktop file and then refresh the published report. This guide covers the exact steps for both environments, including how to handle network drives, SharePoint Online folders, and local file changes.
What You'll Need
- Power BI Desktop: The desktop application installed on your computer. The version installed on your machine must match the version used to publish the report to the service, or you may encounter compatibility issues.
- Power BI Account: A valid account with permission to edit and publish reports to the workspace where the report resides.
- Access to the New Data Location: You must have read access to the new file, folder, or data source you are moving the report to. If the source is a network drive, ensure your computer and the Power BI gateway have access to the same network path.
- Power BI Gateway (Optional): If your new data source is on an on-premises server, network drive, or SQL Server, you need a personal or on-premises data gateway installed to make that data available in the service.
Step-by-Step
The process in Power BI Desktop is straightforward, but it is the foundation for updating the path in the Service. If you skip the desktop step, the report in the cloud will not know where to find the new file.
- Open the Report in Desktop: Launch Power BI Desktop and open the report file (.pbix) that contains the data source you need to move. If prompted, sign in with your Microsoft account.
- Open the Data Source Settings: Look at the ribbon bar at the top of the screen. Click the Transform Data button. This opens the Power Query Editor. In the Power Query Editor ribbon, click the Home tab and select Data Source Settings from the ribbon.
- Identify the Source: A window titled Data Source Settings will appear. You will see a list of all the data sources used in your report. Click on the specific source you wish to update from the list (e.g., Excel Workbook or Folder).
- Click the Change Source Button: Once the specific source is highlighted, look for the Change Source button in the bottom-left corner of the window and click it.
- Navigate to the New File: The Navigator window will open, allowing you to browse to your new file location. Use the file explorer to navigate to the folder containing your updated file. Select the new file and click Load or Convert. Power BI will attempt to connect to this new location using the same query logic as the old one.
- Confirm the Change: Power BI will ask if you are sure you want to change the data source. Click Yes. It may also ask if you want to change all sources of the same type to this new location; select Yes if you want to apply the change globally to the report.
- Close and Apply: Return to the Power BI Desktop main report view. Click Close & Apply in the ribbon. This step refreshes the data model with the new path and saves the changes to the file.
- Save the File: Save the .pbix file to ensure all changes are persisted to your disk. It is good practice to give the file a version number or date in the name.
- Publish to the Service: Click the Publish button in the top-right corner of Power BI Desktop. Select your workspace and publish the report. This uploads the updated .pbix file to the cloud.
- Refresh the Report in the Service: Open the report in the Power BI Service. Go to the Report view. Click the Refresh button in the toolbar, or right-click the visual and select Refresh. The report will now attempt to pull data from the new file path you specified in the desktop file.
Common Mistakes
Updating a file path is simple, but small errors can cause the refresh to fail. Avoid these common pitfalls to ensure a smooth transition.
- Updating Only the Service Path: Some users try to edit the connection string directly in the Power BI Service. This is generally not supported. You must update the file in Desktop and republish. The Service does not have a direct Edit Data Source button for file paths like it does for databases.
- Ignoring the Gateway: If your new file is on a network drive or a local server, the Power BI Service cannot access it directly. You must install and configure an on-premises data gateway. Without this, the refresh will fail with a connection error, even if the desktop file works perfectly.
- Forgetting to Close & Apply: It is common to change the source and save the file, but forget to click Close & Apply in Power Query. This leaves the data model in a pending state. The report will look correct, but the data will not update with the new path until you run this command.
- Using Relative Paths: If your original file used a relative path (e.g.,
\Serverolderile.xlsx) and you move the .pbix file to a different computer, the path may break. It is safer to use absolute UNC paths (\Serverolderile.xlsx) or mapped network drives. - Not Refreshing After Publish: Publishing the file is only the first step. You must manually refresh the report in the Service to load the new data. Automated refresh schedules will not trigger until you perform the first manual refresh to confirm the connection is working.
Tips
Follow these best practices to make your file path updates more reliable and easier to manage.
- Use Power BI Gateway for Network Files: For maximum reliability, use a Power BI Gateway to connect to network files. This keeps the connection active and eliminates the need for users to be logged into the network while the report is refreshing.
- Test the Connection: After changing the source in Desktop, click Test Connection in the Data Source Settings window. This confirms that Power BI can actually reach the new file before you publish.
- Document the Source: If your file path is complex or changes frequently, document the current path in a text file or a shared wiki. This helps other team members understand where the data comes from and how to update it.
- Share the Gateway Credentials: If you are using an on-premises gateway, ensure that the gateway service account has the necessary permissions to read the new file. You may need to update the gateway credentials in the Power BI admin portal.
- Use Folder Queries for Batch Updates: If you have many Excel files in a folder and the names or locations change, use a Power Query Folder query. This allows you to update the folder path in one place, and Power BI will automatically pick up any new files added to that folder.
Troubleshooting
If the report fails to refresh or shows errors after updating the path, follow this troubleshooting checklist to identify the issue.
Refresh Fails with an Error Code
If you see a specific error code in the Power BI Service, it usually indicates a connectivity issue. Check the error message carefully.
- Access Denied: This means the gateway or the service account does not have permission to access the new file. Verify file permissions on the server or network drive.
- File Not Found: The path you entered in Desktop is incorrect or the file has been moved to a location Power BI cannot reach (e.g., a local drive on your computer, not the server). Re-open the file in Desktop and confirm the path is correct.
- Network Error: If the file is on a network drive, check your network connection. Ensure the firewall is not blocking the connection between the gateway and the file server.
Report Shows Old Data
If the report displays data from the old file location, the refresh did not run or failed silently.
- Check the Refresh Log: In the Power BI Service, go to the dataset settings. Click on Refresh History. Look for the most recent run. If it shows a status of Succeeded but the data is old, the file may not have changed. If it shows a status of Failed, click on the failure to see the specific error.
- Force a Manual Refresh: Sometimes the automated refresh schedule fails. Manually refresh the report to force it to run immediately.
Path is Valid in Desktop but Not in Service
This is the most common cause of confusion. The desktop file works because it is running on your machine with your permissions.
- Verify Gateway Configuration: Confirm that the data source is mapped to the correct gateway. If you are using a personal gateway, it must be installed on the machine where the report is being refreshed (or a machine that has access to the data source). If you are using a standard gateway, ensure it is selected in the dataset settings.
- Check Service Principal Access: For Azure Data Lake or SharePoint Online, the gateway uses a service principal. Ensure this service principal has been granted access to the new file location in the cloud.
Power Query Errors (M Code)
If you see errors in Power Query after changing the source, it may be due to data type changes or query dependencies.
- Check Data Types: Sometimes a new file has different data types than the old one (e.g., a column that was text in the old file is now a number in the new file). Open the query in Power Query and ensure data types are consistent.
- Rebuild the Query: If the error is cryptic and difficult to debug, you can try deleting the query and recreating it using the new file. This is a drastic step but can resolve complex dependency issues.
Frequently Asked Questions
Can I update the file path directly in the Power BI Service?
No, you cannot edit the file path directly within the Power BI Service. The Service is read-only regarding data sources. You must make the change in Power BI Desktop on your local computer and then republish the updated file.
Why does the refresh keep failing even though the path is correct?
Common reasons include a missing or misconfigured data gateway, incorrect permissions on the file server, or the file being open on another computer. Check the refresh history logs in the Service for specific error messages.
What is the difference between a personal gateway and an on-premises data gateway?
A personal gateway is installed on your own computer and allows you to refresh reports using data sources that are not publicly accessible, but only for your own content. An on-premises data gateway is a standalone service installed on a server that allows multiple users and multiple workspaces to connect to on-premises data sources.
Does the file path need to be a network path?
No, the file path can be a local path (e.g., C:\Users\Name\Documents\data.xlsx), but this will not work for reports published to the Service. The Service requires the file to be on a location that the gateway can access, such as a network drive or a cloud location like SharePoint Online.
How do I update a folder path for multiple files?
When you change the source in Data Source Settings, select the Folder option. In the Navigator, browse to the new parent folder. Power BI will scan the new folder and update the queries to look there for all files. You must then close and apply.
Will updating the file path break my existing dashboards?
Updating the path does not break the dashboards themselves; it updates the data behind them. However, if the new file has different columns or data types, the dashboards may show errors. Always review the data model after updating the source to ensure compatibility.