Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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
Solved! Go to Solution.
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:
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.
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:
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.
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
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
6 | |
4 | |
3 | |
3 | |
2 |