Forum Discussion

unknown_object's avatar
unknown_object
New Member
2 years ago
Solved

How to change the SQL server datasource on a published report?

Hi all,   I'm pretty new to PowerBi and here's my situation, hoping to avoid this setup (or mistake) in the future:   - I created a report that connects to my local SQL server and its database, e...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi,unknown_object .I am glad to help you.
    If you want to modify the data source of a report, whether it has been published to the service or not.
    You can change the data source information via power query (transform data>Data Source settings)
    Or you can modify the data source by modifying the M code directly through the Advanced Editor (I recommend this approach).
    Luckily, I also found other similar issues that have been resolved, so I hope that helps.
    URL:
    Solved: How to Change Data Sources for Existing Power BI R... - Microsoft Fabric Community
    Solved: Changing Data Source - Microsoft Fabric Community
    like this:

    Here are my tests:

    I have two SQL Server databases with a table of the same name (you need to make sure that you don't have a huge architectural change after your data source change to avoid reporting errors in your reports)


    First use databaseA as the data source to create a report

     

    You can see that the table structure is the same but there is a difference in the data (the nowTime column is not the same).

    Use AdventureWorksDW2017 as the data source to create the report:


    Uploaded to service, configured gateway refreshed successfully (at this point the data source is AdventureWorksDW2017)


    After modifying the data source AdventureWorksDW2022, click Refresh Preview
    The data has changed


    You can see that after uploading to the service, it shows that the data source credentials can not be verified through the gateway, at this time to reconfigure the gateway connection to the new database connection


    After the configuration is complete, the refresh is successful and the service is displayed normally without reporting errors

     


    I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
    Best Regards,
    Carson Jian,
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.