When working with Power BI reports connected to Microsoft Dynamics 365 Business Central, you may find yourself needing to change the data source. Maybe you’re moving from a sandbox to production, switching to a different environment, or simply pointing the report to another company within Business Central.
In this post, we’ll walk through how to update your Business Central connection in Power BI using both OData URLs and the Business Central connector. We’ll also explore how to set up parameters to make switching environments and companies much easier in the future.
Odata String Connection (Least Common Type Connection)
If your report is connected using an OData feed, follow these steps to change the connection:
Step-by-Step:
Open your Power BI file (PBIX).
Go to Home > Transform data to open the Power Query Editor.
In the Queries pane, locate the query connected via OData.
Select it, and in the Formula Bar, you’ll see something like:
TIP: If you get an error stating that x does not exist (your page/table), you make need to expose it in Business Central Web Services in the correct environment.
6. Click Close & Apply to save changes.
Tip: You can find the correct OData URL by going to Business Central > Web Services and copying the URL for the page/ report you’re interested in.
Business Central Connector Type Connection
If your report uses the built-in Business Central connector follow these steps to change the source:
Step-by-Step:
Open Power BI Desktop.
Go to Transform Data
Click on your query in the Queries Panel (Left Side) & let preview load
In the Query Settings Panel, under Applied Steps (Right Side) you will see Navigation. Click on the Cog next to Navigation.
A dialog will open allowing you to select a different Environment (e.g., Sandbox, Production) and Company. In this example I switched the Company (Typically Environment + Company would be changed – I only did Company due to demo data structure).
After selecting the new values (if the Web Service is not named the same in the new Environment, your query might break – best to be consistent), click OK.
Repeat for all Queries.
TIP: You can also do this quickly by creating a new query that is connected to the proper source (Get Data – connect to any Web Service) and using the advanced editor (In the Power Query Editor) to copy and paste into the queries that need updated. Typically, you will only need to copy and paste the first 3 lines.
*Copy the first three lines and paste them into the Advanced Editor of query you desire to update*
8. Close & Apply
Using Parameters (Best for Bulk Updating & Time Saving)
Parameters can be an easy way to switch sources. Manually editing the connection every time can be tedious and time-consuming (especially if you have a lot of queries). Instead, you can use Power BI Parameters to make this dynamic.
Step-by-Step:
Create Parameters:
Go to Manage Parameters > New Parameter.
Create parameters like:
Environment → List of values: Sandbox, Production
Company → List of your companies
TenantID (optional if you’re working across tenants)
API Endpoint (optional if you’re using Web Services or not)
In Power BI Desktop, open Transform Data to get into Power Query.
Go to Manage Parameters > New Parameter.
Create a Parameter for Environment
Name: Environment
Type: Text
Suggested Values: Any value
CurrentValue:
"Production"
Create a Parameter for Company
Name: Company
Type: Text
Suggested Values: Any value
Current Value:
"CRONUS USA, Inc."
Follow these steps after creating parameters named Environment and Company.
Step 1: Open Power Query Editor
In Power BI Desktop, go to the Home tab.
Click Transform data to open the Power Query Editor.
Step 2: Open the Advanced Editor
In the Power Query Editor, find your query (example: Chart_of_Accounts_table) in the Queries pane on the left.
Click on the query name.
Go to the Home tab (still within Power Query Editor).
Click Advanced Editor — this opens the M code for your query.
Step 3: Replace Static Values with Parameters
You’ll see code similar to this (or maybe hardcoded with specific names like PRODUCTION or CRONUS USA, Inc.):
let
Source = Dynamics365BusinessCentral.ApiContentsWithOptions(null, null, null, null),
PRODUCTION = Source{[Name="PRODUCTION"]}[Data],
#"CRONUS USA, Inc." = PRODUCTION{[Name="CRONUS USA, Inc."]}[Data],
WebServices = #"CRONUS USA, Inc."{[Name="WebServices"]}[Data],
Chart_of_Accounts_table = WebServices{[Name="Chart_of_Accounts",Signature="table"]}[Data]
in
Chart_of_Accounts_table
In the Power Query Editor update your Environment and Companies as needed. All Queries will update if set up with parameters, reducing the need to update them individually.
Step 5: Apply the Changes
Click Donein the Advanced Editor.
In the Power Query Editor, click Close & Apply on the Home ribbon to apply the changes.
Welcome to Not a Pickle Blog, a technical resource focused on Power BI and Microsoft Dynamics 365 Business Central. I’m Savannah, and this blog is dedicated to translating complex data models, APIs, and business processes into practical, actionable insights. You’ll find deep dives into reporting patterns, real-world Business Central scenarios, Power BI best practices, and lessons learned from hands-on experience. The goal is simple: build reliable reports, understand your data, and make it work for your business.
Leave a Reply