Forum Discussion
Supercat
2 years agoFrequent Visitor
Replace Value in several columns
Hello everyone, I have been considering this question for a long time. I have a table with several columns where value(integer actually) stores. Also I have another table with column name, inte...
- 2 years ago
as I wrote above - be careful. If your data has errors (you either don't have such columns or some values in tbl_A are not listed in tbl_B). We can fix that:
#problem with column names
List.Intersect({Table.ColumnNames(tbl_A) , List.Distinct(tbl_B[Column1])})#problem with missing values (nothing to replace with):
b = try List.Select(a, (x) => x{0} = value){0}{1} otherwise null][b],see if it works.
Supercat
2 years agoFrequent Visitor
Thank you very much. It may goes wrong when 'null' in the transferred column in table_A, the message as following:
- AlienSx2 years agoSuper User
as I wrote above - be careful. If your data has errors (you either don't have such columns or some values in tbl_A are not listed in tbl_B). We can fix that:
#problem with column names
List.Intersect({Table.ColumnNames(tbl_A) , List.Distinct(tbl_B[Column1])})#problem with missing values (nothing to replace with):
b = try List.Select(a, (x) => x{0} = value){0}{1} otherwise null][b],see if it works.