Forum Discussion

NHCC_IRE's avatar
NHCC_IRE
Frequent Visitor
4 years ago
Solved

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. Bot...
  • Icey's avatar
    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
    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.