Overview
We recommend replacing data source(s) in Tableau using a few steps:
Open the workbook with the visualizations that was connected to the “old” data source;
Check for deprecated fields used in on-the-fly calculations and fix references accordingly
NOTE: It is always good practice to verify that your visualizations have not changed (or that they have changed in the manner you expect them to) after you have completed the replacement described here.
Open the workbook connected to the “old” data source
First, open the workbook where you plan to replace a new data source for the old.
These steps work in an all-or-nothing fashion. If some worksheets should continue to use the “old” data source, and some should use the “new” one, consider creating a copy of your Tableau Workbook that includes only the worksheets that need to move from the “old” to the “new” data source.
Add the “new” data source and Replace Data Source
Once you have opened this workbook, select New Data Source from the Data menu, click on the icon, or use the keyboard shortcut to add a new data source. Then create your new data source, or add one from a data mart / data store that you have access to:
With the new data source added, right-click on a data source in the pane, or open the Data menu, and then select Replace Data Source… from the menu that pops up:
After selecting this value, a new window should pop-up that lets you select which Data Source to replace. Make sure the “old” data source is listed first (as “Current”), and the “new” data source is listed in the “Replacement” drop-down, and click OK.
Replace references to any fields that may have been lost
Sometimes, field names do not match perfectly when we replace data sources. When this happens, you will usually see a red ❗ next to the field that is “broken”. In this example, notice that the field Master Dept is broken. This is because in the new data source, we renamed the field as Master Department Description. So, every time we used Master Dept on the old data source, we want to replace it with the new version (Master Department Description). Luckily, Tableau provides an easy way to do this.
To re-point the “broken” field names to the corrected one(s), right-click on the field name (or left-click on the 🔻 on the right-side of the field name) to open the menu, and select Replace References:
In the window that pops up, select the name of the field from the “new” data source that points to this field name. Notice that the box explains that you will be replacing all references to Master Dept with the field selected (in this case (in this case, it is the Master Department Description field):
This will replace anytime the field Master Dept appeared on the Rows/Columns shelf, as a filter, or in a Calculated field, with the new value Master Department Description. However, this will NOT replace on-the-fly calculations that are built directly onto the Rows/Columns shelf or onto the Marks card (see the next step for how to replace these references).
Check for deprecated fields used in “on-the-fly” calculations
If you have built an on-the-fly calculation directly onto the Row/Columns Shelf or on the Marks card in Tableau, the Replace References technique above will not resolve in these calculations. They will appear as red pills on the shelf / marks card where they are being used:
It is not recommended practice to use these “on-the-fly” calculations - especially if you plan to use the same calculation more than once. However, if you encounter this issue, and you know the correct field to be used, simply double-click on the red pill to open up the text, and then replace the text accordingly. Click Ctrl + Enter to apply the change, or simply hit Enter to complete the calculation.
Alternatively, build a calculated field, and simply drag that field over the red pill to replace it in-place.