Table.FuzzyNestedJoin

The operation merges the rows of two tables, table1 and table2, based on a fuzzy comparison of values in the key columns specified by key1 (for table1) and key2 (for table2). The merged results are di...

Syntax

Table.FuzzyNestedJoin(table1 as table, key1 as any, table2 as table, key2 as any, newColumnName as text, optional joinKind as nullable number, optional joinOptions as nullable record) as table

About

The operation merges the rows of two tables, table1 and table2, based on a fuzzy comparison of values in the key columns specified by key1 (for table1) and key2 (for table2). The merged results are displayed in a new column named newColumnName. Fuzzy matching evaluates text similarity rather than strict equality. The optional parameter joinKind determines the type of join to execute, with the default being a left outer join if not specified. Options include: - InnerJoin - LeftOuterJoin - RightOuterJoin - FullOuterJoin - LeftAntiJoin - RightAntiJoin Additional joinOptions may be included to define how key columns are compared, such as: - ConcurrentRequests: Determines the number of parallel threads (between 1 and 8) used for fuzzy matching, with 1 being the default. - Culture: Allows matching based on culture-specific rules, with options like "ja-JP" for Japanese culture. The default is based on Invariant English culture. - IgnoreCase: Enables case-insensitive key matching, with a default of true. - Igno

Explanation

Perform a left inner fuzzy join of two tables based on the FirstName column using Power Query M language. This code snippet demonstrates how to join two tables together by their FirstName columns, even if there are small variations in the text. The fuzzy join is case-insensitive and does not ignore spaces. The result is an output table that includes records from the first table matched with corresponding records from the second table based on similar FirstNames. Each record in the output table includes the CustomerID, FirstName, Phone, and a nested table with State information from the second table. For example, the output table may show that CustomerID 1 with FirstName "Bob" and Phone "555-1234" is associated with CustomerStateID 1 in Texas, as well as CustomerStateID 2 in California. On the other hand, CustomerID 2 with FirstName "Robert" and Phone "555-4567" does not have any matching records in the second table and therefore has an empty nested table.