Forum Discussion
Multi-conditional find replace in Data Power Query from two seperate columns
Absolutely. Replacer.ReplaceValue is actually a function placeholder that you can replace (no pun intended) with your own (x,y,z) function to do all kinds of wonderful things.
Please provide sanitized sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.
Hi - lbendlin
Thanks for getting back to me. Interesting. I would like to see how this function works in Power Query. I attached a sample of what my data looks like:
In this case I would like to Replace cg_sort_order " 7 " with " 8 " - only if ca_AcctNumber is "4650"and da_AcctNumber is "4191".
Thanks so much for your help!
Trevor
- lbendlin3 years agoSuper User
please provide the sample data in usable format. I can't work with screenshots.
- TBoat3 years agoFrequent Visitor
Okay, I think I added this correctly. Thanks for the help!
- lbendlin3 years agoSuper User
Here is a simple version. For more complex scenarios you can write a custom replacer function.
Table.ReplaceValue(Source,each [cg_sort_order],each if [cg_sort_order]="7" and [ca_AcctNumber]="4650" and [da_AcctNumber]="4191" then "8" else [cg_sort_order],Replacer.ReplaceValue,{"cg_sort_order"})see attached.