Common join issues
If you don't see the results you expect after joining your data, you may need to do some additional cleaning on your field values. The following issues will result in Tableau Prep reading the values as not matching and exclude them from the join:
Different capitalization: My Sales and my sales
Different spelling: Hawaii and Hawai'i
Mispelling or data entry errors: My Company Health and My Company Heath
Name changes: John Smith and John Smith Jr.
Abbreviations: My Company Limited and My Company Ltd
Extra separators: Honolulu and Honolulu (Hawaii)
Extra spaces: This includes extra space between characters, tabbed spaces or extra leading or trailing spaces
Inconsistent use of periods: Returned, not needed. and Returned, not needed.
The good news is that if your field values have any of these issues, you can fix the field values directly in the Join Clauses or work with excluded values by clicking in the Excluded bars in the Summary of Join Results and use the cleaning operations in the profile card menu.
For more information about the different cleaning options available in the Join step, see About cleaning operations.
Fix mismatched fields and more
You can fix mismatched fields right in the join clause. Double-click or right-click the value and select Edit Value from the context menu on the field that you want to fix and enter a new value. Your data changes are tracked and added to the Changes pane right in the Join step.
You can also select multiple values to keep, exclude or filter in the Join Clauses panes, or apply other cleaning operations in the Join Results pane. Depending on which fields you change and where they are in the join process, your change is applied either before or after the join to give you the corrected results.
For more information about cleaning fields see Apply cleaning operations .
Union is a method for combining data by appending rows of one table onto another table. For example, you might want to add new transactions in one table to a list of past transactions in another table. Make sure the tables you union have the same number of fields, the same field names, and the fields are the same data type.
Tip: To maximize performance a single union can have a maximum of 10 inputs. If you need to union more than 10 files or tables, try unioning files in the Input step. For more information about this type of union, see Union files and database tables in the Input step.
Similar to a join, you can use the union operation anywhere in the flow.
To create a union, do the following:
After you add at least two tables to the flow pane, select and drag a related table to the other table until you see the Union option. You can also click the icon and select Union from the menu. A new union step is added in the Flow pane, and the Profile pane updates to show the union profile.
Add additional tables to the union by dragging tables toward the unioned tables until you see the Add option.
In the union profile, review the metadata about the union. You can remove tables from the union as well as see details about any mismatched fields.
Inspect the results of the union
After you create a union, inspect the results of the union to validate that the data in the union is what you expect. To validate your unioned data, check the following areas:
Review the union metadata: The union profile shows some metadata about the union. Here you can see the tables that make up the union, the resulting number of fields and any mismatched fields.
Review the colors for each field: Next to each field listed in the Union summary and above each field in the union profile, is a set of colors. The colors correspond to each table in the union.
If all table colors show for that field, then the union performed correctly for that field. A missing table color indicates that you have mismatched fields.
Mismatched fields are fields that might have similar data but are different in some way. You can see the list of fields that don't match in the Union summary and the tables where they came from. If you want to take a closer look at the data in the fields, select the Show only mismatched fields check box to isolate the mismatched fields in the Union profile.
To fix these field, follow one of the suggestions in the Fix fields that don’t match section below.
When tables in a union don’t match, the union produces extra fields. The extra fields are valid data being excluded from their appropriate context.
To resolve a field mismatch issue, you must merge the mismatched fields together.
There are a number of reasons why fields might not match.
Corresponding fields have different names: If corresponding fields between tables have different names, you can use union recommendations, manually merge fields in the Mismatched Fields list, or rename the field in the union profile to merge the mismatched fields together.
To use union recommendations, do the following:
in the Mismatched Fields list, click on a mismatched field. If a suggested match exists, the matching field is highlighted in yellow.
Suggested matches are based on fields with similar data types and field names.
Hover on the highlighted field and click the plus button to merge the fields.
To manually merge fields in the Mismatched Fields list, do the following:
Select one or more fields in the list.
Right-click or Ctrl-click (MacOS) a selected field and if the merge is valid, the Merge Fields menu option appears.
If you see No options available when you right-click the field, this is because the fields are not eligible to merge. For example trying to merge two fields from the same input.
Click Merge Fields to merge the selected fields.
To rename the field in the union profile pane, right-click the field name and click Rename Field.
Corresponding fields have the same name but are a different type: By default, when the name of corresponding fields match but the data type of the fields don’t, Tableau Prep changes the data type of one of the fields so they are compatible with each other. If Tableau Prep makes this change, it’s noted at the top of the merged field by the Change Data Type icon.
In some cases, Tableau Prep might not pick the correct data type. If that happens and you want to undo the merge, right-click or Ctrl-click (MacOS) the Change Data Type icon and select Separate Inputs with Different Types.
You can then merge the fields again by first changing the data type of one of the fields and then using the suggestions in Additional merge field options.Corresponding tables have different number of fields: To union tables, each table in the union must contain the same number of fields. If a union results in extra fields, merge the field into an existing field.
In addition to the methods described in the above section for merging fields you can also use one of the following methods to merge fields. You can merge fields in any step, except for the Output step.
For information about how to merge fields in the same file, see Merge fields.
To merge fields, do one of the following:
Drag and drop one field onto another. A Drop to merge fields indicator displays.
Select multiple fields and right-click within the selection to open the context menu, and then click Merge Fields.
Select multiple fields, and then click Merge Fields on the context-sensitive toolbar.
No comments:
Post a Comment