Forum Discussion
Conditional Replace Using Outside table
- 1 year ago
Hi Anonymous ,
Table.AddColumn(
#"Added Criteria Column",
"List Replace",
(x) =>
let
match = Table.SelectRows(
#"Conditional Replacement",
(r) => Text.Contains(x[Criteria], r[Criteria1]) and Text.Contains(x[Criteria], r[Criteria2])
),
result = if not Table.IsEmpty(match) then
let
items = Text.Split(x[Criteria], ", "),
filtered = List.RemoveItems(items, {match{0}[Criteria1], match{0}[Criteria2]}),
updated = List.InsertRange(filtered, 0, {match{0}[Replace]}),
combined = Text.Combine(updated, ", ")
in
combined
else
x[Criteria]
in
result
)If my response has resolved your query, please mark it as the Accepted Solution to assist others. Additionally, a 'Kudos' would be appreciated if you found my response helpful.
Thank you
I am guessing you new at PowerQuerey M language. Seems like you are taking the trial and error approach to learning...
Although I could probably solve, this will exceed the time I can spend on it and you would probably end up with a solution you don't understand.
I suggest you search for some good resource for leaning powerquery.
You could start here: Solved: Where to Learn Step by Step Data Prep In Power Que... - Microsoft Fabric Community
- Anonymous1 year agoNot applicable
Yes, very new.
Thanks, I've been looking for some good resources for learning. Most of the documentation expects people already to be fairly fluent.