在Power BI

时间:2019-01-25 16:06:04

标签: powerbi powerquery m

我在Power BI中有一列,其中包含不同的操作系统,例如Windows 7 Professional和Windows 7 Home“等”,我只想让它们显示Windows7。我想使用查找和替换搜索Windows 7 *并替换为Windows 7即可,但是Power BI似乎无法识别*,除非我做错了。

1 个答案:

答案 0 :(得分:0)

当前在GUI中无法实现。我建议添加您对此想法的支持,以增加Microsoft实施此想法的可能性:

Ability to use wildcards in power query transformation find section of replace values


同时,您可以使用Text.Contains函数来解决此问题。

以下是TechNet中的一个示例:

let
    inputString = Excel.CurrentWorkbook(){[Name="InputString"]}[Content][Column1]{0},

    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Added Custom" = Table.AddColumn(Source, "Modified Values", each [Values]),
    replaceTextIfContains = (inputText, old, new) =>

    if (inputText is text and Text.Contains(inputText, old)) then
            new
        else
            inputText,

    #"Replaced Value" = Table.ReplaceValue(#"Added Custom",inputString ,inputString,  replaceTextIfContains,{"Modified Values"})
in
    #"Replaced Value
相关问题