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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
shelbsassy
Resolver I
Resolver I

Need to change SQL in data source

I need to make some changes to the SQL statement I have as a Direct Query using SQL Server in Power BI.  What is the best way to go about doing this without losing all my relationships and connections?  Should I create a new data source using the updated code and then do change data source?  When I look at the query in the advanced editor there are a lot of symbols between the fields that power bi adds so I don't think I can just copy and paste into that window?  Any thoughts would be appreciated I would hate to have to rebuild these dashbards from scratch.  THank yoU!

1 ACCEPTED SOLUTION
Seth_C_Bauer
Community Champion
Community Champion

@shelbsassy So first, cut a copy of your desktop PBIX file and save it as a seperate file. Use that file to mess around with so you aren't so worried about destroying your report.

You can easily access the original query by going to edit queries and clicking on the wheel icon next to the "Source" in the Applied Steps pane on the right hand side. This will open the original prompt and you can copy/paste the new code in there.

 

As long as the new query includes the columns you are already using you shouldn't have any issues with things breaking. You would do this for each query you have, as each would have their own SQL code I assume. (If you have multiple queries and you are worried about relationships breaking)


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

View solution in original post

2 REPLIES 2
Seth_C_Bauer
Community Champion
Community Champion

@shelbsassy So first, cut a copy of your desktop PBIX file and save it as a seperate file. Use that file to mess around with so you aren't so worried about destroying your report.

You can easily access the original query by going to edit queries and clicking on the wheel icon next to the "Source" in the Applied Steps pane on the right hand side. This will open the original prompt and you can copy/paste the new code in there.

 

As long as the new query includes the columns you are already using you shouldn't have any issues with things breaking. You would do this for each query you have, as each would have their own SQL code I assume. (If you have multiple queries and you are worried about relationships breaking)


Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

@Seth_C_Bauer Thank you for your reply!  Just what I needed!  Saved me a lot of work!

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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