How to Change Source in Power BI

Cody Schneider

Nothing stops a Power BI workflow faster than the dreaded "data source not found" error. You move a file, a database gets updated, or a server name changes, and suddenly your perfectly crafted report breaks. The good news is you don’t have to rebuild everything from scratch. This guide will walk you through the simple and effective ways to change your data source in Power BI, so you can get your reports back online in minutes.

Why Would You Need to Change a Power BI Data Source?

Before jumping into the “how,” it’s helpful to understand the common situations that require a data source change. This isn't just about fixing errors, it's a normal part of the data analysis lifecycle.

Here are a few common scenarios:

  • Migrating Files: You might start building a report using an Excel or CSV file on your personal desktop. Later, you move that file to a shared location like SharePoint, OneDrive, or a network drive so your team can collaborate and the Power BI service can refresh it automatically.

  • Switching Environments: It’s a best practice to build and test reports using a development or staging database (a "sandbox"). Once the report is ready, you need to switch the source to the live production database that contains the real customer data.

  • Server or Path Updates: Sometimes, things change on the backend. An IT team might rename a server, restructure a shared folder directory, or migrate an on-premise SQL server to an Azure SQL database.

  • Changing File Types: You might start with a CSV file because it was easy to get, but then transition to a more robust source like a SQL database or a dedicated data warehouse as your project scales.

Whatever the reason, Power BI has flexible tools built-in to handle these changes without causing a major headache.

Method 1: The Quick Fix Using Data Source Settings

For most simple changes, like updating the location of a file or pointing to a new server, the Data Source Settings window is your fastest and easiest option. This is the first place you should always check.

Let's walk through it step-by-step.

Step 1: Open Data Source Settings

First, open your .pbix file in Power BI Desktop. From the main report view, look at the ribbon at the top. On the Home tab, click the Transform Data button, and then in the dropdown menu, select Data source settings.

This will open a dialog box listing every single data connection used in your current Power BI file. If your report pulls from an Excel file, a SharePoint list, and a SQL server, you’ll see all three listed here.

Step 2: Select the Source and Click "Change Source"

Find the data source in the list that you need to update. For example, if you moved an Excel file, you'll see its old file path listed. Click on it to highlight it, and then click the Change Source… button at the bottom of the window.

A new, smaller dialog box will appear. The contents of this box will depend entirely on the type of data source you are changing.

  • For an Excel or CSV file: It will show the current file path and a Browse button, allowing you to navigate to the new file location.

  • For a SQL Server: It will show the fields for Server and Database, allowing you to type in the new server name or database name.

  • For a web source: It will show the URL field, where you can paste the new web address.

Step 3: Update the Details and Apply

Enter the new information. If you're updating a file path, click Browse… and find the file in its new location. If you’re changing a server name, type the new name into the server field. Once you’ve entered the correct information, click OK.

You’ll be taken back to the main Data source settings window. Click Close.

Power BI now knows the new location of your data, but it hasn’t pulled the data from it yet. To finalize the change, click the Refresh button on the Home tab in the main ribbon. The visuals in your report will update with data from the new source, and you’re back in business!

Method 2: Full Control with the Advanced Editor in Power Query

Sometimes, a simple path swap isn't enough. Your data source change might be more complex, or you might need to adjust authentication methods or other connection arguments defined in the M code that powers your queries. In these cases, the Advanced Editor is the tool for the job.

Step 1: Open the Power Query Editor

On the Home tab of the Power BI Desktop ribbon, click the Transform Data button. This will launch the Power Query Editor, which is the main interface for shaping and cleaning your data.

Step 2: Select a Query and Open the Advanced Editor

In the Queries pane on the left, you'll see a list of all your data queries. Select the one corresponding to the data source you want to change. With the query selected, click the Advanced Editor button on the Home tab of the Power Query ribbon.

This opens a window showing the query's M code. It might look intimidating, but don't worry - you only need to focus on one line.

Step 3: Modify the "Source" Step

At the very top of the M code, you'll almost always see a line that starts with Source =. This line defines the data connection. Your goal is to edit this line with the new information.

Let's look at an example. Imagine you are changing a local Excel file to one hosted in SharePoint Online.

Your original code might look like this:

The part you need to change is the first function: Excel.Workbook(File.Contents("C:\...")). You need to replace it with the function for connecting to a web source.

The updated code would look like this:

Once you’ve made your edits, check for any syntax errors (Power Query will tell you at the bottom) and then click Done. In the main Power Query editor, click Close & Apply in the top-left corner to save your changes and refresh the report.

Using the Advanced Editor gives you complete control to change file types, update server names, modify database queries, and more, all from one place.

Method 3: A Pro Move - Using Parameters for Easy Swapping

If you find yourself frequently switching between data sources (like dev and production databases), hardcoding the paths or server names into your queries becomes tedious. A more efficient and scalable solution is to use parameters.

Parameters act as variables that hold your connection information. Instead of editing the query code every time, you just update the value of the parameter.

Step 1: Create a New Parameter

In the Power Query Editor, go to the Home tab and click on Manage Parameters, then select New Parameter from the dropdown.

Step 2: Configure the Parameter

In the Manage Parameters window, set up your parameter.

  • Name: Give it a descriptive name, like pServerName or pFilePath. Using a prefix like "p" is a good practice to easily identify parameters.

  • Description (Optional): Add a note about what it's for.

  • Type: For file paths or server names, choose Text.

  • Suggested Values: You can leave this as Any value.

  • Current Value: Enter the current path or server name. For example, DEV-SQLSERVER01.

Click OK to create the parameter. You’ll now see it listed in your Queries pane on the left.

Step 3: Use the Parameter in Your Query

Now, go back to your query's Advanced Editor. Find the Source step again. This time, instead of putting another hardcoded value, replace the text string with the name of the parameter you just created. Just be sure to remove the quotation marks.

Before (with hardcoded server name):

After (using the parameter):

Step 4: Change the Source by Editing the Parameter

Click Done and then Close & Apply. Now, the next time you need to switch from the development server to the production server, you don't have to touch the M code at all. You can simply click Transform data > Edit parameters, type the new production server name (e.g., PROD-SQLSERVER01) into the parameter's text box, click OK, and hit Refresh. It's clean, simple, and far less error-prone.

Final Thoughts

Updating a data source in Power BI is a fundamental skill that saves a ton of time and prevents unnecessary rework. Whether you're using the straightforward Data Source Settings dialog, diving into the M code in the Advanced Editor, or setting up Parameters for future flexibility, you have multiple ways to keep your reports connected to the right data without starting from scratch.

We know that managing connections, cleaning data, and manually building reports in tools like Power BI can take hours. That's why we created Graphed, your AI data analyst. Stop wrestling with M code and complex configurations, we connect to your marketing and sales platforms (like Google Analytics, Shopify, and Salesforce) instantly. Just describe the dashboard you want in plain English, and Graphed builds it for you in seconds with live, automatically refreshing data. All your analytics, finally in one place, with none of the manual setup.