Replace Reference Trick in Tableau

This blog is about how to tackle a certain type of problem you might encounter when replacing data sources in Tableau.

Specifically, the trick covered in this blog is for when tableau renamed your field when replacing the data source, and you have many calculations that depend on that renamed field.

The table below is the original data that will get replaced.

Original data

Here is the worksheet that uses the original data:

Tables using original data

There are also calculated fields using fields from the original data.

In the end, this is the worksheet including the new calculated fields, and the goal is to replace the data source on this and keep the calculations!

Worksheet using original data for calculated fields

Now here is the new dataset that we want to replace the original data with. You can notice that there are more products and the values for Sales and Cost are not all the same.

New data

After adding the new dataset, you can replace the Original Data with the New Data.

Right click on the original data source and navigate to replace data source
Choose what data source to replace with and hit OK

Now, your workbook could be functioning perfectly fine after this, but it is also very common to have problems with red cells like you see below.

The calculated fields have errors

In this case, you see above that there is an error because adding the new data source changed the field names from [Sales] to [Sales 1], and [Cost] to [Cost 1].

This gives an error to the Profit calculation but also other calculations like the Profit Ratio.

One way to solve this is to go into each calculation and manually change the [Sales 1] to [Sales] and [Cost 1] to [Cost]. However, if your workbook has a lot of calculations, you need a less repetitive method.

Here is one method to fix it.

Step 1: Make a new calculated field of an empty string, and set the name of the calculated field to the field you want to replace the reference of.

Here, we want to replace the reference (change) the field [Sales 1] and [Cost 1] so we make new calculated fields for it.

Step 2: Replace the reference on those new calculated fields

And this should do it! Below is the final output and you can see that the data and the calculations have updated.

Author:
Tomo Mensendiek
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2026 The Information Lab