Part-1

 

Next time, I hope you choose wise. because, to break something twice, one wouldn’t require much strength as the first time did. Likewise, Blending Data in Tableau is choosing wisely what field to drag on each new worksheet. In this blog, I will explain Data Blending. Why we need to understand it and what problems one can face if he/she don’t understand Blending concepts.

Lets start Data Blending.

I have created my own data-set, so that I can explain it better. Lets look at the dataset.

These are the characters of F.R.I.E.N.D.S

I also created a table which includes the dialogues from the series.

 

Now, focus on both of the tables. Customer Id is Caste Id, Product Name is the dialogue, I intentionally make the dialogues in different rows, so that I can help you understand the topic. Remember I only used one dialogue from each character, if you read each row, for same customer id, the sentence will get complete.
Lets bring this data in Tableau.

Step 02, add 2nd DataSource.

Step 3, Notice your fields, and go to new worksheet.

Now lets go to our worksheet, and learn data blending.

 

Notice we have two data sources here. Note : TABLEAU WILL QUERY THESE DATA SOURCES DIFFERENTLY. It will send a query in 1st DataSource and a different query in 2nd DataSource. These queries will return a result in Tableau, and we will get LINKING FIELDS.  WORKING OF BLEND- is there will always be some kind of left outer join to the 1st DataSource we use. The 1st DataSource is called Primary, and the 2nd DataSource is called Secondary. The Primary DataSource will have a blue checkmark and Secondary will have orange check mark. The aggregation is based on the granularity of the primary DataSource.
Blend can be changed at the per-worksheet level.


Lets see this in action

The moment we use a field from a worksheet, irrespective of what data source it is from, that DataSource will become the primary data source.

Notice the blue checkmark, it means it is our Primary DataSource. Any other field we join from other DataSources  will be left joined to this particular DataSource.

Now when we click on the Secondary DataSource, we will see the linking field.

If we don’t drag the linking field, i.e. if we drag any other field from our Primary DataSource, we will notice that the linking field is not activated, simply click on the linking field icon to activate it. Next we bring a field from our Secondary DataSource, see image below

 

Notice the color change to Orange, when we drag a field from secondary DataSource.

Now lets understand the aggregation.

 

Go and see the Datasource and notice how Tableau aggregates sales to sum of sales. This is because, the way Tableau work is that aggregates is to the level of Primary DataSource. The Left join will be based on Primary DataSource, so that table will be preserved. So the cardinality of the Caste DataSource is one row per character and what it means is that the field from Secondary DataSource when queried by Tableau, will make sure they return one record per character as well. In simple words, it will group all the sales by character Id and aggregates them.

 

Now common frustration with Blend is the “*”

 

The * simply means, there are more than 1 record, and Tableau need to find a way to show them. In our case, if we make Dialogues DataSource as Primary, we get all records instead of an *.

 

Please note that the Blending is at a Worksheet level, the salary is not aggregated, if our requirement is salary of each character, we need to know which field we should drag on the canvas. Also notice that Monica is absent from the above table, because we don’t have any dialogue for her, and our granularity is different from previous table. In our previous sheet we had all the characters.

 

 

 

The Data School
Author: The Data School