Forum Discussion
Report Server - Batch change of data source
- 4 years ago
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 SourceXml:
<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.