Watch the video on YouTube: https://youtu.be/RT1vYFr_6wY
Ever since its release in 2020, Tableau's semantic layer has been a big topic of discussion.
Let's break it down:
Tableau says that there's a new layer in your data model called the logical layer. This sits on top of another layer known as the physical layer.
In the logical layer, you can add different tables and link them together. Even though they are connected, these tables don't merge in the data source - they stay separate. This means they keep their original level of detail.
Think of logical tables like boxes for your merged physical tables. These boxes can contain one physical table or multiple ones that are linked together.
So, what does this mean? Think of the physical layer as the actual structure of your data table. In Tableau, it's one big table where all the rows are stitched together. The logical layer, however, treats everything separately. This lets Tableau show how the data is connected, without messing up the original details of each table.
Let's take an example of an employee table and a title table.
In the employee table, each row is a different employee. In the title table, each row is a different job title. If we connect the two tables using the job title id, we make a new table. In this new table, each row still shows one unique employee, but the job titles aren't unique anymore. This is because we've combined the title table with the employee table.
But what if we add salary amounts to this mix?
Now let's say our employee table also includes salary amounts, and we have another table with employee contact information. One row in this new table represents a unique phone number. The problem is that an employee can have more than one phone number. If we combine these tables, we get a table that represents a phone number for an employee. The salary amounts get copied because the employee record is copied. This would give us a wrong total if we try to sum up the salaries in Tableau.
Tableau's relationship feature can help with this. It shows a 'noodle' instead of a Venn diagram to show that the tables are connected, but not merged.
If we make a relationship based on the employee id, we connect the rows that have the same id, but we don't make a new table. When we pull this into Tableau, we can see the information together, but the salaries will add up properly since the salary column only exists in the employee table.
We can see rows for every phone number because there's a connection between the employee and the phone number. And even though it looks like the salary is tied to each phone number, the salary amount is only counted once for each employee record.
Before, we had to use LOD calculations to make sure we were adding things up properly. But with relationships, we can make sure that we keep the original details of all the tables while still showing the information in one place.
Still puzzled by Tableau's data model? Feel free to get in touch with me - I'm here to help!