Defining Relationships

Tableau automatically recognizes when a field you are using in the view exists in a secondary data source. These fields are marked with a link icon in the Data window and an automatic relationship is created between the two data sources. The relationship allows you to blend data from both data sources on a single sheet. You must have a linked field in the view in order to use data from the secondary data source. For example, a workbook may have two connections: Superstore Sales and Sales Plan. These two connections have related information including the columns for Customer Segment and Customer State. The data from Sales Plan (the secondary data source) cannot be used (blended) until one of those common fields has been added to the view.
You can modify the automatic relationships or create new custom relationships by selecting Data > Edit Relationships.
The Relationships dialog box lets you select a primary data source using the drop-down list at the top. Then you can select a secondary data source in a list on the left side of the dialog box. The right side of the dialog box lists any relationships that have been added.
To add and edit relationships:
  1. Select Data > Edit Relationships to open the Relationships dialog box.

  2. Make sure that the primary data source is selected from the down list.

  3. Select a secondary data source from the list on the left.

  4. Select Custom at the top of the relationships list.
  5. Click the Add button or select an existing relationship and click the Edit button.

  6. Select a field in the primary data source and map it to matching field in the secondary data source.

  7. When finished, click OK.
  8. Add and Remove as many relationships as necessary, and when finished, click OK again.
    When the related field from the primary data source is used in the view, the linked fields in the secondary data source are marked with a link icon in the Data window to show that they are related to a field in the primary data source.
The relationship matches values based on the member aliases. You can fix up fields that don’t match by editing the aliases. For example, when mapping a State Name field in the primary data source to a State Abbreviation field in the secondary data source, “AK” will not map correctly to “Alaska”. You’ll have to modify the aliases in one of the data sources.

No comments:

Post a Comment