OpenBI Docs Buy

Table.FuzzyNestedJoin

Joins two tables on key texts that are spelled alike and puts each row's matches in a new column, as a nested table.

Group: Table. Power Query M has it too: a query that uses it is written as in Power BI.

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
ParameterTypeDescription
table1tableThe first (left) table: its rows are kept.
key1anyThe key column of table1, or a list of them; they must hold texts.
table2tableThe table to find matches in.
key2anyThe key column of table2, or a list: as many as key1.
newColumnNametextThe name of the column that holds the matches.
joinKindnullable number
optional
JoinKind.LeftOuter when left out; or JoinKind.Inner and the other join kinds.
joinOptionsnullable record
optional
IgnoreCase, IgnoreSpace, Threshold (0.80 unless you give another), NumberOfMatches (how many matches a row may have), SimilarityColumnName (adds the similarity as a column) and TransformationTable.

Returns

table. table1's columns and the new column: in each row, a table of its matches in table2.

Remarks

  • The key columns must be of type text. Expand the new column with Table.ExpandTableColumn.
  • How two texts are compared, and the few pairs near a threshold that come out otherwise, are in the M functions page's Fuzzy matching section.

Examples

Matches nested, then the segment brought out

let
    Merged = Table.FuzzyNestedJoin(
        #table(type table [Order = number, Customer = text],
        {{1, "Nordvik AS"}, {2, "nordvik as"}, {3, "Fjelstad Bygg"}, {4, "Lunde Handel"}}),
        {"Customer"},
        #table(type table [Name = text, Segment = text],
        {{"Nordvik AS", "Retail"}, {"Fjellstad Bygg", "Trade"}}),
        {"Name"},
        "Match")
in
    Table.ExpandTableColumn(Merged, "Match", {"Segment"})
OrderCustomerSegment
1Nordvik ASRetail
2nordvik asRetail
3Fjelstad ByggTrade
4Lunde Handelnull

Lunde Handel is kept: the default kind is a left outer join, and its segment is null.

Table.FuzzyJoin, Table.NestedJoin, Table.ExpandTableColumn.

Last updated · OpenBI Studio 0.3.79