Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Auto replace all values in all columns with specific value

Hello,

I have the following table loaded in Power Query which is updated regularly with changing number of columns in the source Excel spreadsheet. I am trying to find a dynamic way to replace all values in the entire table where it is 0 to null. Is this possible?

 

Currently, this is the step used but it is not dynamic when the columns change:

 

= Table.ReplaceValue(Source,"0",null,Replacer.ReplaceValue,{"Week number", "Stock", "Sold", "Returns"})

 

 

Week numberStockSoldReturns
11218932
221220012
314200
48468451
5050052
62310200
7514510
8874551323
9084464
10152540
115600360
126146140
  • You can replace 

    {"Week number", "Stock", "Sold", "Returns"}

    with

    Table.ColumnNames(Source)

1 Reply

  • artemus's avatar
    artemus
    Microsoft Employee

    You can replace 

    {"Week number", "Stock", "Sold", "Returns"}

    with

    Table.ColumnNames(Source)