Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
unknown_object
New Member

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, everything works and the report is done. 

- I have published the report to a workspace.

- I have setup the on premise data gateway on another machine that is running the target SQL server and its database. This is configured and up and running on my PowerBi portal, all good on this part.

- If I want to refresh my published report it fails, but that's normal because there is no connection to the dataset.

- In the settings of the semanctic model the datasource refers to my local SQL database connection, lets say SERVER-A;Database1

 

Desired result: 

The published report should be connected to a different SQL server (SERVER-B;Database1), the one that is accessible through the gateway. The database remains exactly the same. I just worked on a copy of it on my local machine. 

 

How can I point my report to the correct server to fetch its data? 

Much appreciated if anyone could help 😎

Thanks!

1 ACCEPTED SOLUTION
v-jtian-msft
Community Support
Community Support

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:

vjtianmsft_0-1722824550977.png

vjtianmsft_1-1722824563114.png

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)

vjtianmsft_2-1722824605933.png
First use databaseA as the data source to create a report

vjtianmsft_3-1722824717026.png

 

vjtianmsft_4-1722824813182.png

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:

vjtianmsft_10-1722825110693.png


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

vjtianmsft_6-1722824881351.png
After modifying the data source AdventureWorksDW2022, click Refresh Preview
The data has changed

vjtianmsft_7-1722824904550.png
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

vjtianmsft_8-1722824968181.png
After the configuration is complete, the refresh is successful and the service is displayed normally without reporting errors
vjtianmsft_9-1722825003136.png

 

vjtianmsft_11-1722825212384.png


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.


 

View solution in original post

3 REPLIES 3
v-jtian-msft
Community Support
Community Support

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:

vjtianmsft_0-1722824550977.png

vjtianmsft_1-1722824563114.png

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)

vjtianmsft_2-1722824605933.png
First use databaseA as the data source to create a report

vjtianmsft_3-1722824717026.png

 

vjtianmsft_4-1722824813182.png

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:

vjtianmsft_10-1722825110693.png


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

vjtianmsft_6-1722824881351.png
After modifying the data source AdventureWorksDW2022, click Refresh Preview
The data has changed

vjtianmsft_7-1722824904550.png
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

vjtianmsft_8-1722824968181.png
After the configuration is complete, the refresh is successful and the service is displayed normally without reporting errors
vjtianmsft_9-1722825003136.png

 

vjtianmsft_11-1722825212384.png


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.


 

Hi @v-jtian-msft ,

 

Thanks for the extremly detailed post 😀

In all my attempts I was convinced that I had done these different approaches, maybe not in the right sequence...and mixing different guides or possible solutions.

But I started over following your instructions and I managed to get it to work.

All up and running now!

 

Thanks

unknown_object
New Member

Also in addition, I have already tried the <File - Options and Settings - Data Source Settings> in PowerBi desktop to change the values but then the report want to apply the changes and fails because I don't have access to the remote SQL server, therefore I cannot publish this updated version to my workspace (I think).

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

AugPowerBI_Carousel

Power BI Monthly Update - August 2024

Check out the August 2024 Power BI update to learn about new features.

August Carousel

Fabric Community Update - August 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors