Forum Discussion
ReplaceValue with multiple condition
- 6 years ago
Hi Anonymous ,
To add a custom column as below.
if [Item ID] = "2810-00131" then if [Size] = 150 then 105 else then [Size]M code for your reference.
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMrIwNNA1MDA0NlTSUTI0NVCK1YlWMjYwNdA1NDI1s4AJxgIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"Item ID" = _t, Size = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Size", Int64.Type}}), #"Added Custom" = Table.AddColumn(#"Changed Type", "Custom", each if [Item ID] = "2810-00131" and [Size] = 150 then 105 else [Size]) in #"Added Custom" - Anonymous6 years ago
Thanks v-frfei-msft
I summarized your suggestion and create the working "Table.ReplaceValue" :
#"Replaced Value" = Table.ReplaceValue(Source,each [Size],each if [Item ID]="2810-00131" and [Size]="150" then "105" else [Size],Replacer.ReplaceText,{"Size"})
Regards,
Henry
Anonymous
Create a new column and write below DAX
Thanks adityavighne , however I want to do in Query Editor, since it is not a one-off adjustment, more data will be update with same problem. Plus there will be more adjustments, like
If Item ID = 1010-28000 then replace "20" to "30"
If Item ID = 1030-28000 then replace "120" to "50"
etc
Regards,
Henry
- adityavighne6 years agoContinued Contributor
Anonymous
go for a conditional column in Query editor. below is the e.g need to replace as per your requirements
- Anonymous6 years agoNot applicable
Hi Aditya,
The Query Editor just contain 1 condition right?
If Item ID equal to 2810-00131 Then (Output)
I will need the output = Replace "150" in Column [Size] into "105".
Which seems the Query Editor cannot as the "output" is just one value and not a condition.
Thanks in advance.
Regards,
Henry
- adityavighne6 years agoContinued Contributor
Anonymous
add conditions as many by clicking on "Add Clause"