Forum Discussion
Change pbix data source programmatically
- Anonymous9 years ago
Hi JorgeDiego,
As you said, power bi not support to direct modified the datasource without open the pbix file, perhaps you can submit your requirement to ideas.
In addition, you can 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:
Regards,
Xiaoxin Sheng
Hi, JorgeDiego
Today I am srufing the web with the same reuqirement you need in 2017.
Just repharasng the requirment again that, I have multiple clients with their own Servers and Databases but the report schema is same. Right now I am manually handeling this by creating Worksapces for each client on app.powerbi.com and creating a copy of report for each client, updating its Datasource on PowerBi Desktop and publishing it again on the client specific worksapce.
I want to automate this process using PowerShell Script.
So I want to Update the Datasource of a PBIX file and according to client and publish it on client specific worksapce on app.powerbi.com
Please help.
- RamyaRascher3 years agoRegular Visitor
Hi, any luck finding a solution? I have the same requirement.
- MRIZ2 years ago
Helper II
No i am still strugling 😞