ItzCamm
ItzCamm

Reputation: 49

Change / Replace value based on another column in Power Query?

this is a rather simple request though I'm not sure the best way to approach in power query.

Consider two columns, Job_Reference and Trade. in the Trade column there is a value PAINTER/PLASTERER, though when the Job_Reference value begins with a 2, it should be changed to PLASTERER. And when it begins with 3, it should be changed to PAINTER. If the Job_Reference is anything else it should remain PAINTER/PLASTERER.

Thank you!

Upvotes: 0

Views: 1122

Answers (1)

horseyride
horseyride

Reputation: 21318

Try

let Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Change Text"=  Table.ReplaceValue(Source,  each [Trade], each
     if Text.Start(Text.From([Job_Reference]),1)="3" then "PAINTER" else
     if Text.Start(Text.From([Job_Reference]),1)="2" then "PLASTERER" else
     [Trade] ,Replacer.ReplaceValue,{"Trade"})
in #"Change Text"   

enter image description here

Upvotes: 1

Related Questions