I have a workbook which I want to be able to hook up to a few different variants of the underlying database structure. Essentially I want to be able to run either against the live database schema, or against a restructured (denormalised) variant, to provide better performance. But I don't want to have to maintain multiple copies of my workbooks.
So I'm trying to define a repeatable process for swapping out the "live" data source definitions and swapping in the "de-normalised" definitions, so that I can maintain a single copy of each workbook and then point copies of the workbook at different underlying data structures.
At first glance this seems to be a simple matter of ensuring that the alternative variants of each data source present identical field names, by adjusting the field aliases in the data source definition to match the names used in the original data source. But it appears that Tableau only uses the field alias (referred to as the "column caption" in the workbook XML) for resolving some of the references to fields during replacement. Specifically, fields referenced in filter conditions and possibly other references within calculated fields seem to rely on the internal name automatically derived by Tableau when first constructing the data source (referred to as the "map key" under the covers). This causes lots of mis-matches, with the unrecognised fields removed from all sheets.
The reason that the default names are different in the de-normalised variants of the data sources is that many of the tables I am joining have columns with the same names in multiple tables. On building the data source, whenever Tableau comes across a field name which already exists in the data source it automatically generates an internal name constructed by prefixing the field name with the table name. When building the de-normalised variants, the order of adding the tables is different, so different fields get the qualified or unqualified variants of the names.
Fixing up the differences using the field name aliases in the data source seems to work fine for the names of fields that are actually placed on shelves, but not for underlying references within calculated fields or filter conditions. That results in lots of fields being removed from lots of sheets throughout the workbook when replacing the data sources.
I could achieve the functional outcome I'm after by replacing the multiple table data source definitions with either custom SQL connections or references to database views which hide the details. But the performance impact of that would be too great since it would prevent Tableau from doing join culling etc.
I don't expect that there is an easy answer to this - but I'd be interested to hear if anyone else has hit the same issue and even more interested if anyone has come up with a simple, repeatable and reliable process for doing what I'm trying to do.