<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Fuzzy matching logic in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Fuzzy-matching-logic/m-p/4661524#M60617</link>
    <description>&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;RawAccount&lt;/P&gt;&lt;P&gt;3m inc&lt;/P&gt;&lt;P&gt;7-evelen, inc.&lt;/P&gt;&lt;P&gt;Rolex PLC&lt;/P&gt;&lt;P&gt;Avanaid pte ltd&lt;/P&gt;&lt;P&gt;Deloite pty ltd&lt;/P&gt;</description>
    <pubDate>Mon, 21 Apr 2025 15:33:26 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2025-04-21T15:33:26Z</dc:date>
    <item>
      <title>Fuzzy matching logic</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Fuzzy-matching-logic/m-p/4660613#M60590</link>
      <description>&lt;P&gt;I have already removed the extensions using this M code in Power Query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;let&lt;BR /&gt;// Load your Excel file/table&lt;BR /&gt;Source = Excel.Workbook(File.Contents("C:\Users\mark.jz.yeap\Documents\ATCi - Mark\MatchingDatasets - 10 Apr 2025\NRF 2024 delegate list.xlsx"), null, true),&lt;BR /&gt;Table2_Table = Source{[Item="Table2",Kind="Table"]}[Data],&lt;BR /&gt;#"Changed Type" = Table.TransformColumnTypes(Table2_Table, {{"Company Name", type text}}),&lt;/P&gt;&lt;P&gt;// Define the list of suffixes to remove&lt;BR /&gt;Suffixes = {&lt;BR /&gt;" intl pte ltd", " (Private) Limited", " Pte Lte"," (Pte) Ltd"," PTE LTD", "PTE. LTD.", " Pvt. Ltd.", " PTE. LTD", " Pte Ltd", " Pte. Ltd.", " Private Limited", " Public Company Limited"," COMPANY LIMITED", " Co., LTD.","Co; Ltd", "co.,ltd.", " Co.,LTD"," Co.,Ltd.", " Co.,Ltd"," Co., Ltd.", " Co., Ltd", " CO., LTD.", " Company Limited", " LTD.", " LTDA", " LTD",&lt;BR /&gt;" Ltd.", " Ltda", " Ltd", ", Inc.", ", Inc", ",INC."," INC.", " Inc.", " Inc", " INC", " Corporation", " Corporate", " Corp.", " Corp", " Sdn Bhd", " Bhd", " PLC", " Pte", " Limited", " Pty", " limited", " LIMITED",&lt;BR /&gt;"PTe", " pte ltd", " CO.", " S.A.", " Plc", "CORPORATION", " LLC", " B.V.", ".com", " G.K.", " GmbH", " AE"&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;// Clean suffixes from each company name&lt;BR /&gt;Cleaned = Table.AddColumn(#"Changed Type", "RawAccount", each&lt;BR /&gt;Text.Trim(&lt;BR /&gt;List.Accumulate(&lt;BR /&gt;Suffixes,&lt;BR /&gt;[Company Name],&lt;BR /&gt;(state, current) =&amp;gt; Text.Replace(state, current, "")&lt;BR /&gt;)&lt;BR /&gt;), type text&lt;BR /&gt;)&lt;BR /&gt;in&lt;BR /&gt;Cleaned&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After removing those extensions, I need to match using this logic:&lt;/P&gt;&lt;P&gt;When the raw account only has 1 letter in it, then it should be exact match - i.e threshold should be 1&lt;/P&gt;&lt;P&gt;Same for 2 letters&lt;/P&gt;&lt;P&gt;Same for 3 letters&lt;/P&gt;&lt;P&gt;Same for 4 letters&lt;/P&gt;&lt;P&gt;When the raw account name has 5 letters - the threshold should be 0.9&lt;/P&gt;&lt;P&gt;and when it exceeds 5 letters - the threshold should be 0.8&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;May not need to merge anything.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please assist.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2025 07:32:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Fuzzy-matching-logic/m-p/4660613#M60590</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-04-21T07:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: Fuzzy matching logic</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Fuzzy-matching-logic/m-p/4661189#M60609</link>
      <description>&lt;LI-CODE lang="markup"&gt; I need to match using this logic&lt;/LI-CODE&gt;
&lt;P&gt;What do you need to match?&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2025 12:54:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Fuzzy-matching-logic/m-p/4661189#M60609</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2025-04-21T12:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: Fuzzy matching logic</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Fuzzy-matching-logic/m-p/4661524#M60617</link>
      <description>&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;RawAccount&lt;/P&gt;&lt;P&gt;3m inc&lt;/P&gt;&lt;P&gt;7-evelen, inc.&lt;/P&gt;&lt;P&gt;Rolex PLC&lt;/P&gt;&lt;P&gt;Avanaid pte ltd&lt;/P&gt;&lt;P&gt;Deloite pty ltd&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2025 15:33:26 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Fuzzy-matching-logic/m-p/4661524#M60617</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-04-21T15:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: Fuzzy matching logic</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Fuzzy-matching-logic/m-p/4661623#M60619</link>
      <description>&lt;P&gt;Here is one, slightly brute force, implementation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lbendlin_0-1745255646871.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1262027iF0F637579740FBB6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lbendlin_0-1745255646871.png" alt="lbendlin_0-1745255646871.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;let
  Source = Table.FromRows(
    Json.Document(
      Binary.Decompress(
        Binary.FromText(
          "i45WMs5VyMxLVorViVYy100tS81JzdMBieiBhYLyc1IrFAJ8nME8x7LEvMTMFIWCklSFnJIUsJhLak5+JpBfUFIJEYsFAA==", 
          BinaryEncoding.Base64
        ), 
        Compression.Deflate
      )
    ), 
    let
      _t = ((type nullable text) meta [Serialized.Text = true])
    in
      type table [RawAccount = _t]
  ), 
  Suffixes = List.Buffer(
    {
      " intl pte ltd", 
      " (Private) Limited", 
      " Pte Lte", 
      " (Pte) Ltd", 
      " PTE LTD", 
      "PTE. LTD.", 
      " Pvt. Ltd.", 
      " PTE. LTD", 
      " Pte Ltd", 
      " Pte. Ltd.", 
      " Private Limited", 
      " Public Company Limited", 
      " COMPANY LIMITED", 
      " Co., LTD.", 
      "Co; Ltd", 
      "co.,ltd.", 
      " Co.,LTD", 
      " Co.,Ltd.", 
      " Co.,Ltd", 
      " Co., Ltd.", 
      " Co., Ltd", 
      " CO., LTD.", 
      " Company Limited", 
      " LTD.", 
      " LTDA", 
      " LTD", 
      " Ltd.", 
      " Ltda", 
      " Ltd", 
      ", Inc.", 
      ", Inc", 
      ",INC.", 
      " INC.", 
      " Inc.", 
      " Inc", 
      " INC", 
      " Corporation", 
      " Corporate", 
      " Corp.", 
      " Corp", 
      " Sdn Bhd", 
      " Bhd", 
      " PLC", 
      " Pte", 
      " Limited", 
      " Pty", 
      " limited", 
      " LIMITED", 
      "PTe", 
      " pte ltd", 
      " CO.", 
      " S.A.", 
      " Plc", 
      "CORPORATION", 
      " LLC", 
      " B.V.", 
      ".com", 
      " G.K.", 
      " GmbH", 
      " AE"
    }
  ), 
  #"Added Custom" = Table.AddColumn(
    Source, 
    "Cleaned", 
    each List.Accumulate(
      {0 .. List.Count(Suffixes) - 1}, 
      [RawAccount], 
      (s, c) =&amp;gt;
        if Text.Lower(Text.End(s, Text.Length(Suffixes{c}))) = Text.Lower(Suffixes{c}) then
          Text.RemoveRange(s, Text.Length(s) - Text.Length(Suffixes{c}), Text.Length(Suffixes{c}))
        else
          s
    ), 
    type text
  )
in
  #"Added Custom"&lt;/LI-CODE&gt;
&lt;P&gt;How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done". Once you examined the code, replace the entire Source step with your own source.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2025 17:15:42 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Fuzzy-matching-logic/m-p/4661623#M60619</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2025-04-21T17:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: Fuzzy matching logic</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Fuzzy-matching-logic/m-p/4661750#M60621</link>
      <description>&lt;P&gt;Thankyou,&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/100342"&gt;@lbendlin&lt;/a&gt;, for your response.&lt;BR /&gt;&lt;BR /&gt;Hi Mark-JZ-Yeap,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;We appreciate your inquiry through the Microsoft Fabric Community Forum.&lt;/P&gt;
&lt;P&gt;Based on my understanding, you are seeking to match the RawAccount column against a reference company list using fuzzy logic, with varying similarity thresholds depending on the length of each cleaned name. As Power BI’s fuzzy matching in Power Query does not directly support dynamic thresholds for each row, please follow the steps outlined below, which may assist in resolving the issue:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Continue using your suffix-removal M script to cleanse both the RawAccount and reference list.&lt;/LI&gt;
&lt;LI&gt;Add two columns: one for the string length and another to assign a similarity threshold based on that length.&lt;/LI&gt;
&lt;LI&gt;Split your dataset into three categories: Length ≤ 4 → exact match (threshold = 1.0); Length = 5 → fuzzy match (threshold = 0.9); and Length &amp;gt; 5 → fuzzy match (threshold = 0.8).&lt;/LI&gt;
&lt;LI&gt;Perform merges accordingly using Power Query’s fuzzy matching feature.&lt;/LI&gt;
&lt;LI&gt;Recombine the results using Append Queries.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;This method effectively replicates your logic without any manual matching requirements and will scale well.&lt;/P&gt;
&lt;P&gt;Additionally, please refer to the following links for more information:&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/power-query/fuzzy-matching" target="_blank"&gt;How fuzzy matching works in Power Query - Power Query | Microsoft Learn&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://learn.microsoft.com/en-us/power-query/merge-queries-overview#fuzzy-matching" target="_blank"&gt;Merge queries overview - Power Query | Microsoft Learn&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;If you find our response helpful, kindly mark it as the accepted solution and provide kudos. This will assist other community members facing similar queries.&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Apr 2025 18:47:08 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Fuzzy-matching-logic/m-p/4661750#M60621</guid>
      <dc:creator>v-pnaroju-msft</dc:creator>
      <dc:date>2025-04-21T18:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: Fuzzy matching logic</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Fuzzy-matching-logic/m-p/4662282#M60639</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What if you can remove those extensions without using hardcore?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 06:27:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Fuzzy-matching-logic/m-p/4662282#M60639</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2025-04-22T06:27:25Z</dc:date>
    </item>
  </channel>
</rss>

