Relationships work on what Tableau calls the Logical Layer, while traditional joins work on the Physical Layer. Let’s have a look at what those two layers actually mean and why they have their names.
Tableau’s Physical Layer
So, the Physical Layer is the one we were used to until Relationships were introduced. We dragged tables into our data source view in Tableau and joined them. Of course, in the early days, this layer didn’t have a name, it was just the canvas of our data source. The name “Physical Layer” is derived from the physical tables that we drag into this layer. This means we can see every table from a database on the left in our data source view.
Tableau’s Logical Layer
The Logical Layer, on the other hand, works with the results of the Physical Layer. In other words: The new entity that we build by joining physical tables, which doesn’t exist anywhere in our database, is a logical table. If we only have one physical table without any joining happening, then the logical table that results from it is exactly the same.
Logical tables then can, or rather have to be, related to each other. This relationship is defined by at least one field, on which these two logical tables will be connected in the end. This is quite similar to a join, where we define at least one identifying field that tells Tableau which rows of both physical tables belong to one another.
Note, that once this relationship is established, Tableau doesn’t do anything else in the Logical Layer. The actual connection of both logical tables does not happen until we are in the view (more on that in the “1st Rule of Relationships” in the next chapter of this series).
How the Layers Interact
Since Tableau version 2020.2, the Logical Layer is the first layer we see when we open up our data source in Tableau. Dragging in tables from the left (physical tables), adds them – without us seeing it – to the Physical Layer, which then results in the logical table (the grey rectangles).
As you can see, the Physical Layer is still there, although hidden behind the Logical Layer. We can still join tables in the traditional way if we want to. Double-click on one of the rectangles to open the Physical Layer and join tables. You can leave the layer by clicking the x on the far upper right. Note that whenever there are physical tables joined somewhere, the resulting logical table (the grey rectangle) will show a tiny Venn diagram.
In the view where we build our visualizations, we also see a difference between the layers. In the case that we have only one logical table in our data source, which may be comprised of joined physical tables, we then see those physical tables in our view. But when we have more than one logical table – in other words, when we have a relationship somewhere – we will always see these logical tables in our view. Let’s have a look at the differences:
There is one more place where the difference between the Physical Layer and Logical Layer has serious implications that we will cover in a later post. I am talking about extracts. The very first option within the extract edit window is whether Tableau should build extract tables for logical tables or for physical tables. In most cases, we should go for the first option. Sometimes, but not very often, extracts of physical tables can make the extract faster. Tableau’s own documentation for that is pretty straightforward, but we will soon dedicate an article to that topic that might be easier to follow.
The next chapter will cover the ground rules of relationships.