One way that might work would be to use the Table.FuzzyGroup
method:
let
Source = Excel.CurrentWorkbook(){[Name="Table17"]}[Content],
typed = Table.TransformColumnTypes(Source,{{"Id", Int64.Type}, {"Mapping String", type text}}),
//fuzzy group by Mapping String
//Threshold is set by trial and error
fuzzyGroup = Table.FuzzyGroup(typed, "Mapping String",{
{"Id", each List.First([Id]), Int64.Type},
{"Mapped IDs", each Text.Combine(
List.Transform(
List.Sort(List.RemoveFirstN([Id]), Order.Ascending) , each Number.ToText(_)),";"),
type text}
},
[IgnoreCase=true, IgnoreSpace=true, Threshold=0.5]
),
//Set column orders as desired and sort by Id
#"Reordered Columns" = Table.ReorderColumns(fuzzyGroup,{"Id", "Mapping String", "Mapped IDs"}),
#"Sorted Rows" = Table.Sort(#"Reordered Columns",{{"Id", Order.Ascending}})
in
#"Sorted Rows"