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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Replace References - changing data sources

I am connected to a PostgreSQL database and have created several reports from a table contained within this database.  For simplicity, lets call that table_1.  To hopefully speed up my connections and refreshes, rather than connecting live to this table, someone is creating a materialized view for me to use.  This means I will have a new data source and a new table name.  What is the best way now to replace my data source while keeping all of my formulas?  In Tableau, you could just replace references for your fields, so if you right clicked on Field A, selected replace references and select Field B, anyplace in your entire workbook that used Field A would now be replaced with Field B.  I do not see a similar feature in Power BI, but I assume there has to be an easy way to change data sources without redoing all of my formulas. 

1 ACCEPTED SOLUTION
nirvana_moksh
Impactful Individual
Impactful Individual

@Anonymous - You can first create a new connection to this data source and once the preview is loaded in Power Query mode, click on Advanced Editor and copy the script for the establishment of the connection to the newly created view. Go to your existing query and click on the Advanced Editor for that query and replace the string that you see after 'Let source' for your table with this and make the necessary changes in the script like making sure the commas are in place, and that the proper reference names are listed after "#"

 

Edit - Also, as a best practice I always declare Parameters for Server Name, Database Name etc, which you can utilize too, so as to make these kinda changes a little more easier.

View solution in original post

3 REPLIES 3
nirvana_moksh
Impactful Individual
Impactful Individual

@Anonymous - You can first create a new connection to this data source and once the preview is loaded in Power Query mode, click on Advanced Editor and copy the script for the establishment of the connection to the newly created view. Go to your existing query and click on the Advanced Editor for that query and replace the string that you see after 'Let source' for your table with this and make the necessary changes in the script like making sure the commas are in place, and that the proper reference names are listed after "#"

 

Edit - Also, as a best practice I always declare Parameters for Server Name, Database Name etc, which you can utilize too, so as to make these kinda changes a little more easier.

@nirvana_moksh That is a great way to change the entire data source. But is there a way for the actual 'replace reference' of fields like in tableau. Say I have a page with many views(or even an entire report).  The (e.g.) "Total Cost" on all of the different views are connected to a specific field. If I would feel another field actually makes more sense to go under "Total Cost", is there any way I can use a few clicks or edit a query to replace the reference of this "Total Cost" to another field(It has to simultaneously change for all the views in the report)? Just like the REPLACE REFERENCE in Tableau. Thanks in Advance.

Anonymous
Not applicable

Thank you, @nirvana_moksh!  I appreciate the help.

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.