Have you ever updated or replaced your datasource in an existing Tableau workbook and all your calculations have broken due to renamed fields? I’m going to teach you how to solve this issue.

I’ve created a simple view in Sample Superstore of average discounts split by regions and coloured by category.

I have renamed the Region field to Region Area so that when I bring in the new data source, Tableau gets confused as it cannot find Region anywhere in the existing workbook!

In order to show you how calculations can break when replacing data sources, I have created a calculation called Region Area Calc:

IF [Region Area]=’Central’ THEN ‘Middle’ ELSE [Region Area] END

Replacing your datascource:

There are other methods to replace your current datasource, but this is the method I like to use. In the top-left corner of the window, press the New Data Source button.

Once you’ve chosen the new datasource to add, it will show up in the data pane. The datasource you originally used in the workbook will have a small blue tick, while your new one will not.

Right-click on the datasource you were originally using and select Replace Data Source…

In the next pop-up, you should select your current data source and the new one you want to replace it with. Then hit OK.

Replacing References

Oh no! Everything has broken! Tableau cannot find the ‘Region Area’ field in the new datasource, and therefore it can’t complete the Region Area Calc. I know these fields are breaking my workbook as they have an exclamation mark beside them.

In the Data pane we can see that the blue tick is now on the new data source. Right-click on the Region Area pill and select ‘Replace References’.

In the next pop-up, find the correct field from the new data source. In our case we are selecting Region and clicking OK.

Tadaaa! All fixed. The field is still called Region in the new data source but it is using Region Area as a reference from the old data source.

The use case:

This method is very useful when you have data that is updated and field names are changed, which I have experienced many times during client projects at the dataschool as my colleagues work on preparing the data while I work on creating dashboards with that same data.

I hope this is useful to you!