Thursday, May 6, 2021

Referencing Another Data Source without Relationship in Tableau

This is about a particular kind of data blending.

How many approaches of data blending do you know? 

Never mind. I know 3 approaches to blend them. There may be more. Tell me if you know any.

My understanding of data blending is: More than one data source is being used in the worksheet. Whenever I see an orange label on a data source or pill, some kind of blending is taking place.

Here are the 3 that I know. Note that the first two are based on relationships. The 3rd is not.

1.Dimension-based blending

This is the most common one. It's like a left join, but it is not quite. Joining takes place at row level. Blending is at dimension level. It is based on dimension linking or creating relationship between two dimensions in either of the data sources. The secondary data source only provides attributes to the primary data source, which is in aggregation based on the linking dimension. No new dimension will come from a secondary data source.

2.Filter from a secondary data source

We can apply a dimension filter from one data source to another, as long as the other data source has the same field with exactly the same name, such as Date, Country etc. So a filter may come from a secondary data source.

3.Reference from a secondary data source

Without any dimension linking or even without any common dimension or any relationship, we can always drag a field from a secondary data source and drop it in the worksheet in view. This happens when we need to reference a metric in that secondary data source, such as Max Date, Average Sales etc. We can use these metrics in calculations or in reference lines etc.

A curious message always pops up saying you can't reference the measure in another data source without relationship. This is not true. We can. We don't need a relationship to use that value.

Here is an example. We need to visualize the sales from California and Delaware. The data are in two separate sources.

To align both in date range and in vertical scale, we referenced 3 metrics from the California data set: (Uncheck all the linking dimensions first. Otherwise the Max/Min values may be different.)

  • Max order date
  • Min order date
  • Max monthly sales amount
We created 3 reference lines in the Delaware sales chart. Hide them in real case. Download the workbook to view the details.
In some earlier posts 1 2, we also described techniques using the third data blending approach.

Voila, the emphasis of the post is about the third data blending technique. Hope it helps. Leave messages in the comment area if you have questions.

2 comments:

  1. Hall of Fame Zen Master Jonathon Drummey pointed me to the 4th data blending: Primary Group and Re-Aliasing https://help.tableau.com/current/pro/desktop/en-us/multipleconnections_create_primary_group.htm An interesting approach to create groups and aliases in the primary data source.

    ReplyDelete