KNOWLEDGE BASE

Finding in Which Data Sources Any Given Field Value Exists


Published: 30 Sep 2016
Last Modified Date: 29 Aug 2017

Issue

When using two data sources in a left join or blend, field values that do not exist in the primary data source will result in null values for the corresponding field in the secondary data source. Furthermore, when the data is combined via a join/union, Tableau Desktop treats it a single data source.

Environment

Tableau Desktop

Resolution

Option 1

Add a [data source] field to the data outside of Tableau Desktop, and combine the data sources into a single data source. This approach would allow a greater flexibility in calculations than the second solution. For instance, one could then use the following formula to find out how many data sources contain each value of [field to compare].
{FIXED [field to compare]: COUNTD([data source])}

Option 2

As an alternative to modifying the data sources, it is possible to create a Union of all the data sources, and blend this Union with individual connections for each of the data sources. Using this method, a formula similar to the below example is needed to determine where a given value of [field to compare] occurs in another data source. The resultant values in the view will be either True or Null. The drawback of this method is that, because ATTR() is already an aggregation, further aggregations will not be possible. Instead, it will be necessary to use Table Calculations. For a demonstration of data source testing using a Union with blending, see the attached packaged workbook.
ATTR([name of data source].[field to compare]) = ATTR(name of other data source].[field to compare])

Cause

In order to be used in a single view in Tableau Desktop, data from different sources must be related.
Did this article resolve the issue?