Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
NHCC_IRE
Frequent Visitor

Report Server - Batch change of data source

We have two machines that run Report Server on them: one for production and one for development where the development server is a clone of the production server plus any development we are doing. Both machines also have SQL servers running on them with identical sets of data. Currently, all reports point to the production SQL server for data. However, as the number of reports has grown, we are starting to see report refresh slowdowns and reports getting stuck because the reports on both machines are refreshing at the same time using the same machine. We have manually shifted the refresh times on the development server to later to avoid this. However, a more satisfying solution would be that all the reports on the development server using the SQL server on the development server and not the production server. Does anyone know of any easy (e.g. SQL, Power Query, etc.)  way of changing the data source of many reports as a batch process to accomplish this? 

 

              - - - Andrew 

1 ACCEPTED SOLUTION
Icey
Community Support
Community Support

Hi @NHCC_IRE ,

 

Bsed on my knowledge, it is not supported to change the data source directly without open the .pbix file. Please try to create query parameter like what @d_gosbell mentioned.

 

Or, maybe you can also try to store your connection string to a config file, then write a custom function to analysis this file. After these steps, you can change the datasource without open the pbix file.(After you modified the config file, you should refresh it at pbix report to get the newest data).

 

Sample:

let
xmlTable = Xml.Tables(File.Contents("C:\Users\xxxxx\Desktop\test.xml")),
server=xmlTable[Server]{0},
database=xmlTable[Database]{0},
Source= Sql.Database(server,database)
in
Source

 

Xml:

<config>
<Server>"abc"</Server>
<Database>"edd"</Database>
</config>

Screenshots:

Icey_0-1649146021171.png

 

 

Reference: Solved: Re: Change pbix data source programmatically - Microsoft Power BI Community

 

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Icey
Community Support
Community Support

Hi @NHCC_IRE ,

 

Bsed on my knowledge, it is not supported to change the data source directly without open the .pbix file. Please try to create query parameter like what @d_gosbell mentioned.

 

Or, maybe you can also try to store your connection string to a config file, then write a custom function to analysis this file. After these steps, you can change the datasource without open the pbix file.(After you modified the config file, you should refresh it at pbix report to get the newest data).

 

Sample:

let
xmlTable = Xml.Tables(File.Contents("C:\Users\xxxxx\Desktop\test.xml")),
server=xmlTable[Server]{0},
database=xmlTable[Database]{0},
Source= Sql.Database(server,database)
in
Source

 

Xml:

<config>
<Server>"abc"</Server>
<Database>"edd"</Database>
</config>

Screenshots:

Icey_0-1649146021171.png

 

 

Reference: Solved: Re: Change pbix data source programmatically - Microsoft Power BI Community

 

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

d_gosbell
Super User
Super User

You could try this technique using Parameters in your Power Query code then changing them with a PowerShell script https://docs.microsoft.com/en-us/power-bi/report-server/connect-data-source-apis 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.