Blending data

If a workbook uses data from more than one data source, you can blend data. Blending data is different from joining tables. It enables you to combine data from different sources. Tableau makes it very simple to perform this activity.

If you have more than one source of data, you can blend it together in Tableau. Alternatively, you might want to blend the data in a data warehouse or a data store in a single place, outside of the Tableau software.

Sometimes, when we put data together, we get an error message saying Fields cannot be used from the data source…. This means Tableau could not associate the new imported file with the existing file because it could not match any of the column names. This recipe will explain how to get around this issue.

Getting ready

For the exercises in this recipe, let's continue working on the Chapter 6 workbook.

How to do it…

  1. Duplicate the Golden Record worksheet and rename the copy to Blending Example.
  2. Next, import the HDI.xlsx file by going to the Data menu item and then choosing the Connect to Data… option.
  3. In the pane that appears, click on Text File, browse to find the HDI.csv, and click on Open.
  4. Click on the filename and rename the data source connection to HDI.
  5. Rename the columns. Rename F1 to Level of Human Development.
  6. Rename the F2 column to countryname.
  7. Rename the F3 column to Year.
  8. Rename the F4 column to HDI Rank. Then, click on Go To Worksheet.
  9. When all the data has been imported, you will see the new HDI connection on the Data shelf. Here is an example of this:
    How to do it…
  10. Drag the HDI Rank field over to the Color button on the Marks shelf.
  11. You will get the following error message, and when you do, click on OK:
    How to do it…
  12. To sort the error message, click on the HDI data source in the Data shelf that you set up earlier in this recipe.
  13. Right-click on the Country field and click on Rename.
  14. Rename Country to countryname and click on OK. Note that the case must match exactly as is or Tableau will not be able to match the fields.
  15. On the right-hand side of countryname, you should now see a data blend mark appear, as shown in the following screenshot:
    How to do it…
  16. The HDI Rank field will appear as a measure, which means that Tableau will try to aggregate it. Drag the field up to the Dimensions pane so that it is used as a way of describing the data, rather than as an ordinal piece of data that can be added.
  17. Now, repeat the step of dragging the HDI Rank field over to the Color button on the Marks shelf.

How it works…

In this recipe, we looked at blending two disparate data sources together, and we saw how easy it is to relate data sources together based on the column name.

Blending data is a key part of creating guided analytics for the user. This feature is useful in solving end-to-end problems, since the user can get up to speed quickly, without a detailed understanding of the underlying data sources. Further, it allows users to quickly connect to the data without having to associate the data together. With this, you can assume that the data is clean, of course. It also helps that non-matching column names can be associated with one another simply by renaming one of the columns so that the columns match and are recognized as the relationship between the tables.

One word of warning, however: it is easy to become blithe about setting up relationships in the data based on the column name if you are unfamiliar with the sources. It can be possible to have identical column names in different data sources, but the data can mean totally different things and refer to different business processes. It is easy to set up the relationships, but it's also imperative to check the relationships, too. What's technically correct may not be correct from the business perspective.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset