Relationships
1. Relationships
Nice job so far! Now that you've got the hang of unions and joins, we'll move on to Relationships, which is another way to combine data.2. Relationships
Relationships was first released in May of 2020, making it a very recent addition to Tableau relative to Joins and Unions.3. Relationships
A relationship describes how two tables relate to each other, based on common fields, but does not merge the tables together or append fields. This means when a relationship is created between tables, the tables remain separate, maintaining their individual level of detail and fields. For example, in the previous exercises when you performed some joins and unions, it created a new table called Orders 2016-2020 that's made up of 7 tables.4. Relationships
Now let's say we want to add some manufacturers data as a relationship. It would look like this on the data source page. See how a new table isn't defined, rather Orders 2016-2020 and manufacturers dot csv are two different logical tables where no specific join is defined.5. Relationships
Still, one or more related fields are selected to define the relationship. In this case, the relationship is defined by one field, the product name. Tableau suggests thinking of a relationship as a contract between two tables. If you were to build a viz with fields from these related tables, Tableau will bring data from both using that contract to decide what join would be most appropriate in the given context.6. Relationships vs joins
So what's the benefit of this? Let's compare it to Joins. As we learned there are several types of joins that all have different use cases depending on your scenario. Although, we used a left join in most of the earlier exercises, there may be a time where we actually need an inner or right join. With relationships, we don't need to commit to a join type upfront. We only need define the matching field names. Relationships dynamically change the join types depending on the fields being used in the visualization. This allows you to focus on the fields you need rather than thinking about the underlying joins. For example, you don't have to worry about which unmatched rows you will lose by doing a left, right, or inner join. In enterprise environment, relationships are intended to reduce the upfront data preparation, such as custom SQL or database views, needed to prepare the data for loading into Tableau. Relationships enable you to preserve all the detailed records of multiple tables in a single data source. Overall, relationships are more flexible and more dynamic than joins. Joins are more static because the join type must be defined before you start your analysis. If you change the join type during your analysis, it will impact the work in your sheets.7. Let's practice!
Alright, you ready to try it out for yourself? Let's get to it!Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.