Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
I can't seem to get this to work in query editor:
let
Source = Excel.Workbook
#promote header = ....
#"Replaced OTH" = Table.ReplaceValue(#"promote header"," ","OTH",Replacer.ReplaceValue,{"Gender"}),
#"Replaced Gender" = Table.ReplaceValue(#"Replaced OTH",each if [Surname] = "Manly" then "Male" else [Gender],[Gender],Replacer.ReplaceValue,{"Gender"})
in
#"Replaced Gender"
Im trying to change the gender column to "Male" if Surname column contains "Manly". It gives me an error:
Expression.Error: There is an unknown identifier. Did you use the [field] shorthand for a _[field] outside of an 'each' expression?
Solved! Go to Solution.
You are right. I was confusing Table.ReplaceValues with Table.TransformColumns.
My solution works though, but the code you are looking for:
#"Replaced Value" = Table.ReplaceValue(#"Replaced OTH",each [Gender],each if [Surname] = "Manly" then "Male" else [Gender],Replacer.ReplaceValue,{"Gender"})
Edit: it seems you switched "old" and "new" in your cide.
User | Count |
---|---|
127 | |
108 | |
99 | |
63 | |
62 |
User | Count |
---|---|
136 | |
113 | |
102 | |
71 | |
60 |