Search code examples
excelpowerbipowerquerydata-cleaningm

ReplaceValue not working in Excel Query Editor


Im trying to complete a table.ReplaceValue step in my query editor but the values dont seem to be changing with the conditions ive set.

The steps im trying to replicate in code in the editor:

  1. Whilst a filter to only show Requried is applied to column M, Filter Column N to only show FALSE and change this value to Outstanding (copy it down to the remaining rows)

  2. Remove filter from Column N & M

  3. Column M – Apply filter to just show Required

  4. Column N – Apply filter to just show TRUE and change this value to Received (copy it down to the remaining rows).

    = Table.ReplaceValue(#"Replaced Value7",each [P&C info received] ,each if [P&C info required] = "Required" and [P&C info received]= "false" then "Outstanding " else if [P&C info required] = "Required" and [P&C info received]= "true" then "Received " else [P&C info received],Replacer.ReplaceText,{"P&C info received"})

M and N are the columns im working with in the spreadsheet table.


Solution

  • Try this:

    = Table.ReplaceValue(#"Replaced Value7",each [P&C info received] ,each if [P&C info required] = "Required" and [P&C info received]= "false" then "Outstanding " else if [P&C info required] = "Required" and [P&C info received]= "true" then "Received  " else  [P&C info received],Replacer.ReplaceText,{"P&C info received"})