【问题标题】:How to match the most approximate values of one column with the string column in another table in Power Query of Power BI?Power BI的Power Query如何将一列的最近似值与另一表中的字符串列进行匹配?
【发布时间】:2022-12-30 06:01:03
【问题描述】:

表格1:

表 2:

结果:

我试过使用模糊匹配,但它没有给我结果。

请帮忙!

【问题讨论】:

  • 下次发文字,不要图片,请

标签: powerbi powerquery powerbi-desktop powerbi-datasource


【解决方案1】:

在 powerquery 中查看这是否适合您

在 Table1 中查找 Table2 中的项目实例

创建表 2 后表 1 的代码:

let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
RelativeMerge = Table.AddColumn(Source, "RelativeJoin", 
        (x) => Text.Combine(Table.SelectRows(Table2, each Text.Contains(x[Column1],[Column1], Comparer.OrdinalIgnoreCase))[Column1],"::")),
y=List.Transform({1 .. List.Max(List.Transform(RelativeMerge[RelativeJoin], each List.Count(Text.Split(_,"::"))))}, each "match_"& Text.From(_)),
#"Split Column" = Table.SplitColumn(RelativeMerge, "RelativeJoin", Splitter.SplitTextByDelimiter("::", QuoteStyle.Csv), y)
in #"Split Column"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-07
    相关资源
    最近更新 更多