根据条件在 Power Query 中替换数值。

huangapple go评论123阅读模式
英文:

Replacing values based on condition in Power Query

问题

我想将一些熟人值替换为关键词以特定值,将“google”和“searching google”都转换为“seo”。

我尝试过使用替换方法,但您应该指定所有要替换的值,这是不可行的。
如果有一个包含“contain”功能的解决办法,我认为会有所帮助,但我找不到它。

英文:

I want to replace some acquaintance values by keywords to specific value, converting both "google" and "searching google" to "seo"

I tried replace but you should specify all the values to replace with and that's not possible.
if there is a solution with "contain" function i think it would help but i couldn't find it.

答案1

得分: 2

[![输入图像描述][1]][1]


[![输入图像描述][2]][2]


  [1]: https://i.stack.imgur.com/uEZDk.png
  [2]: https://i.stack.imgur.com/aizvK.png

    let
        Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
        Custom1 = Table.TransformColumns( Source, {{"Column1",(x)=> if Text.Contains(x, "google") then "seo" else x}})
    in
        Custom1
英文:

根据条件在 Power Query 中替换数值。

根据条件在 Power Query 中替换数值。

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Custom1 = Table.TransformColumns( Source, {{"Column1",(x)=> if Text.Contains(x, "google") then "seo" else x}})
in
    Custom1

答案2

得分: 0

你需要按照这个教程中的说明添加一个条件列- 这里

这基本上是一个简单的新条件列,具有如下图所示的if/else条件-

根据条件在 Power Query 中替换数值。

英文:

You need to add a conditional column as explained here in this tutorial- Here

This is basically a simple new conditional column with if/else condition as shown in this below image-

根据条件在 Power Query 中替换数值。

huangapple
  • 本文由 发表于 2023年3月7日 14:58:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/75658829.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定