To change a data source in Power BI, navigate to the Home tab, select Transform Data, click Data source settings, and choose Change Source. This process allows you to redirect your reports to a new file path, a different server, or an updated database without having to rebuild your visualizations from scratch.

Updating a data source is a common requirement when moving files from a local drive to a shared network folder, migrating a database from a development environment to production, or renaming a source file. By changing the connection string rather than deleting and re-adding the data, Power BI maintains the relationship between the source columns and the existing measures, calculated columns, and visuals in your report. Note that menu labels may differ slightly depending on your version of Power BI Desktop or your regional settings.

What You'll Need

  • Power BI Desktop installed on your machine.
  • The exact file path, server address, or database name for the new data source.
  • Necessary access permissions (read/write) for the new source location.
  • The new data source must have the same schema (column names and data types) as the original source to avoid breaking the report.

Step-by-Step

  1. Open your Power BI Report: Launch Power BI Desktop and open the .pbix file that requires the data source update.
  2. Access Data Source Settings: On the Home ribbon, locate the "Transform Data" dropdown menu. Click the arrow and select "Data source settings" from the list. This opens a separate window listing all sources currently connected to the report.
  3. Select the Source: In the Data source settings window, you will see a list of all connections. Click on the specific file path or server address that you wish to change.
  4. Initiate the Change: Once the source is highlighted, click the "Change Source" button located at the bottom of the window.
  5. Provide New Credentials or Path:
    • For Files (Excel, CSV, JSON): A file browser window will appear. Navigate to the new folder location, select the correct file, and click Open.
    • For Databases (SQL Server, Oracle): A dialog box will appear asking for the new Server and Database names. Type the new server address and the name of the database, then click OK.
  6. Update Permissions: If the new source requires different authentication (such as switching from Windows authentication to a Database user), Power BI will prompt you to "Edit Permissions." Select the appropriate authentication method and enter your credentials.
  7. Apply Changes: Click Close on the Data source settings window. Power BI will then prompt you with a yellow bar at the top of the screen stating that there are pending changes. Click "Apply Changes."
  8. Verify the Data: Once the refresh is complete, check your report pages. Ensure that the visuals are loading correctly and that no "Fix This" errors have appeared on your charts.

Common Mistakes

One of the most frequent errors is changing the source to a file that has a different internal structure. If you rename a column in the new Excel file or change a data type (e.g., changing a numeric ID to text), Power BI will not be able to find the original reference. This results in a "Column not found" error in the Power Query editor. Always ensure the new source is a structural mirror of the old one.

Another common mistake is neglecting the file path format. Users often copy a path from a local drive (C:\Users\Name\Documents) when the report will eventually be published to the Power BI Service. If the Power BI Service cannot reach that local path via a gateway, the scheduled refresh will fail. It is better to use a UNC path (\\Server\Folder\File) or a cloud-based source like SharePoint or OneDrive.

Some users attempt to change the source by deleting the table and importing it again. This is a critical mistake because deleting a table removes all the DAX measures and relationships associated with that table. Changing the source via the settings menu preserves these elements; deleting the table destroys them.

Tips

To make your reports more flexible, consider using Parameters for your data sources. Instead of hard-coding a file path, you can create a parameter called "FolderPath." In the Power Query editor, you can then set the source to use this parameter. When you need to change the data source in the future, you simply change the parameter value in one place, and every query using that parameter updates automatically.

If you are working with multiple files in a folder, use the "Folder" connector rather than the "Excel" or "CSV" connector. This allows Power BI to combine all files in a directory. When the data source changes, you only need to point Power BI to the new folder, and it will automatically ingest any files meeting your filter criteria.

Always create a backup copy of your .pbix file before performing a major data source migration. While changing the source is generally safe, a mismatch in schema can lead to a cascade of errors in Power Query that can be tedious to fix manually if you don't have a clean version to revert to.

Troubleshooting

If the data refresh fails after changing the source, the first step is to open the Power Query Editor (Transform Data > Transform Data). Look for any steps in the "Applied Steps" pane on the right that have a red exclamation mark. This usually indicates that a column name changed in the new source, causing the "Promoted Headers" or "Changed Type" steps to fail.

If you encounter an "Access Forbidden" or "Invalid Credentials" error, go back to Data source settings, select the source, and click "Edit Permissions." Clear the existing permissions and re-enter your credentials. This is often necessary when switching between different environments, such as moving from a Test server to a Production server.

If the report is loading but the data looks incorrect, check the "Source" step in Power Query. Click the gear icon next to the Source step to verify that the path is exactly what you intended. Sometimes, a trailing slash or a slight typo in the server name can cause Power BI to connect to a default or cached version of the data rather than the intended new source.

In cases where the "Change Source" button is greyed out, ensure that you are not currently in the middle of an active refresh or that the file is not locked by another application. Restarting Power BI Desktop usually resolves interface glitches.

Frequently Asked Questions

Can I change the data source after publishing the report to the Power BI Service?

Yes, but it is done differently. You must go to the dataset settings in the Power BI Service, navigate to the "Gateway connection" or "Data source credentials" section, and update the connection details there. If the source is a local file, you will need an On-premises data gateway installed and configured.

Will changing the data source delete my DAX measures?

No. As long as you use the "Change Source" option in the Data source settings, your DAX measures, calculated columns, and visual layouts remain intact. The measures are linked to the table name and column names, not the physical location of the file.

What happens if the new source has extra columns?

Power BI will generally ignore extra columns in the source file unless you have a step in Power Query that explicitly selects all columns or uses a "Remove Other Columns" step. The report will continue to function using the columns it recognizes.

Can I change a source from an Excel file to a SQL database?

While technically possible through the Advanced Editor in Power Query, it is not recommended via the "Change Source" button. Because the connection methods for a flat file and a relational database are entirely different, you would likely have to rewrite the M-code for the source step and potentially re-map all subsequent transformation steps.

How do I change the source for multiple tables at once?

If all your tables come from the same database or folder, changing the source in the Data source settings window updates the connection for all queries using that specific source. You do not need to change them one by one if they share a single connection string.