根据其他两个列在电源查询中放置字符串

发布于 2025-02-01 04:42:26 字数 767 浏览 2 评论 0原文

当在两列中满足条件时,我正在尝试用字符串替换值。

第1列第2列第3列3
A1步骤1- a
B2步骤2的描述 - b
步骤1的描述b cC 11步骤1- c c
c c3步骤3的描述
A1步骤1- a
B3步骤3的描述 - B 3步骤3-对于B的第一步,

我尝试了该代码

= Table.ReplaceValue(
 #"Renamed Columns",
 each [Column 3],
 each if [Column 1] = "A" and [Column 2] = "1" then "Step 1 - Description for step one for A" else [NULL]) 

,我计划在第1列和第2列的所有组合中迭代此代码第3列中的字符串。

我将如何完成此操作?提前致谢!

I'm trying to replace a value with an string when a condition is met in two columns.

Column 1Column 2Column 3
A1Step 1 - Description for step one for A
B2Step 2 - Description for step one for B
C1Step 1 - Description for step one for C
C3Step 3 - Description for step one for C
A1Step 1 - Description for step one for A
B3Step 3 - Description for step one for B

I tried the code

= Table.ReplaceValue(
 #"Renamed Columns",
 each [Column 3],
 each if [Column 1] = "A" and [Column 2] = "1" then "Step 1 - Description for step one for A" else [NULL]) 

where I was planning to iterate this code for all the combinations of column 1 and 2 (where each combination gets a certain string in column 3).

How would I be able to get this done? Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

痴梦一场 2025-02-08 04:42:26

我肯定会创建并合并桌子,但是如果您想这样做

#"Replaced Value" = Table.ReplaceValue(#"Renamed Columns", each [Column3], each if [Column2]=1 and [Column1]="A" then "Step 1 - Description for step one for A" else null ,Replacer.ReplaceText,{"Column3"})

,您必须做否则null 否则[null] 列名。 否则null 也不起作用,因为PowerQuery是案例敏感的

,还要检查您是否打算使用第1列 column1 差异是区别在于n和1

I would definitely create and merge a table, but if you want to do it this way

#"Replaced Value" = Table.ReplaceValue(#"Renamed Columns", each [Column3], each if [Column2]=1 and [Column1]="A" then "Step 1 - Description for step one for A" else null ,Replacer.ReplaceText,{"Column3"})

note, you have to do else null not else [NULL] unless you really have that column name. else NULL would not work either since powerquery is case sensitive

Also check if you mean to use Column 1 or Column1 the difference being a space between the n and 1

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文