OpenBI Docs Buy

Table.FuzzyJoin

Joins two tables on key texts that are spelled alike rather than the same, into one flat table.

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

Syntax

Table.FuzzyJoin(table1 as table, key1 as any, table2 as table, key2 as any, optional joinKind as nullable number, optional joinOptions as nullable record) as table
ParameterTypeDescription
table1tableThe first (left) table.
key1anyThe key column of table1, or a list of them; they must hold texts.
table2tableThe second (right) table.
key2anyThe key column of table2, or a list: as many as key1.
joinKindnullable number
optional
JoinKind.Inner when left out; or JoinKind.LeftOuter 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 then table2's, one row per matching pair.

Remarks

  • The key columns must be of type text: set their type first, with Table.TransformColumnTypes or a table type.
  • Unlike Table.FuzzyNestedJoin, the default kind is an inner join: rows without a match are left out.
  • 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

Customer names written differently

Table.FuzzyJoin(
    #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"})
OrderCustomerNameSegment
1Nordvik ASNordvik ASRetail
2nordvik asNordvik ASRetail
3Fjelstad ByggFjellstad ByggTrade

Case is ignored, and one letter missing still matches; Lunde Handel has no match and an inner join leaves it out.

Every order, with the similarity

Table.FuzzyJoin(
    #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"},
    JoinKind.LeftOuter, [SimilarityColumnName = "Similarity"])
OrderCustomerNameSegmentSimilarity
1Nordvik ASNordvik ASRetail1
2nordvik asNordvik ASRetail1
3Fjelstad ByggFjellstad ByggTrade0.97
4Lunde Handelnullnullnull

Table.FuzzyNestedJoin, Table.Join, Table.FuzzyGroup.

Last updated · OpenBI Studio 0.3.79