Forum Discussion
Anonymous
4 years agoNot applicable
Circular error when replacing values in one column off another column
Hello. I am trying to simple replace values in one column off the values of another column IF Dateofcall = 1/1/2019 then I want th evalue in the GMR_Agency to be "RR" so I wrote this: =Table.Rep...
- Anonymous4 years ago
Hi Anonymous ,
It is worth noting that what is marked in red in the figure below is not the name of the query but the name of the applied step.
I created a sample pbix file(see attachment), please check whether that is what you want.
1. Assume that you have the below table
2. Replace the value of column GMR_Agency with "RR" when the date of column DateofCall is equal to 2019/1/1 in Power Query Editor using Table.ReplaceValue function
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Vcy7DcAgDAXAXVwjGZuIJCX/ISz2XyMvpEBprzgzSokcCQurl5umM8r5FZBuKwV2scRNtYIOlgBSv6g10Pmj3kHhu1QWjQGKm+YD", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [GMR_Agency = _t, DateofCall = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"GMR_Agency", type text}, {"DateofCall", type date}}), #"Replaced Value" = Table.ReplaceValue(#"Changed Type",each [GMR_Agency],each if [DateofCall] =#date(2019, 1, 1) then "RR" else [GMR_Agency],Replacer.ReplaceValue,{"GMR_Agency"}) in #"Replaced Value"Best Regards
xander2121
4 years agoFrequent Visitor
Hello Anonymous
You can try to create a new column. I think Power BI won't let you replace values in a column.
Instead you create a new column with you conditions.