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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
schwinnen
Helper V
Helper V

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

@schwinnen - 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

@schwinnen - 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.

Thank you, @nirvana_moksh!  I appreciate the help.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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