Forum Discussion
Replace values for all columns without ranging
Hi,
I hope to replace values for all columns no matter how many new columns will be added in the future?
Currently I do it ranging particular columns but will come more new columns over time.
Hi Anonymous - you can modify your Power Query (M code) script to dynamically apply the replacement logic to every column in the table.
slight adjustment as per the mcode change,
#"Replaced Value" = Table.ReplaceValue(
#"Filtered Rows",
null,
0,
Replacer.ReplaceValue,
Table.ColumnNames(#"Filtered Rows")
)Locate the step where you are replacing values.
Replace your existing hardcoded column names with the dynamic method shown above.
Save and apply the changes.
1 Reply
- rajendraongole1
Super User
Hi Anonymous - you can modify your Power Query (M code) script to dynamically apply the replacement logic to every column in the table.
slight adjustment as per the mcode change,
#"Replaced Value" = Table.ReplaceValue(
#"Filtered Rows",
null,
0,
Replacer.ReplaceValue,
Table.ColumnNames(#"Filtered Rows")
)Locate the step where you are replacing values.
Replace your existing hardcoded column names with the dynamic method shown above.
Save and apply the changes.