Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

REPLACE a field value based on 2 other field values

I am getting an "unexpected error" when i try to use this replacevalue function.

 

I am trying to replace a value in field [IQ_Depletions] based off [UPC] and [DivStr]  all fields are numeric.

 

Table.ReplaceValue(#"Renamed Columns",each [IQ_Depletions],
each if ([UPC]=8066095721 and [DivStr]=660103 then 1 else [IQ_Depletions],Replacer.ReplaceValue,{"IQ_Depletions"})

  • One ( is not required. Use this

    = Table.ReplaceValue(#"Renamed Columns",each [IQ_Depletions],
    each if [UPC]=8066095721 and [DivStr]=660103 then 1 else [IQ_Depletions],Replacer.ReplaceValue,{"IQ_Depletions"})

1 Reply

  • Vijay_A_Verma's avatar
    Vijay_A_Verma
    Most Valuable Professional

    One ( is not required. Use this

    = Table.ReplaceValue(#"Renamed Columns",each [IQ_Depletions],
    each if [UPC]=8066095721 and [DivStr]=660103 then 1 else [IQ_Depletions],Replacer.ReplaceValue,{"IQ_Depletions"})