I'm coming back to a post post from three years ago. The question then was, how to add columns based on a list.
I want to go further on the solution provided:
let myFunc = ( myTable, myNewColumnList) =>
let foo = List.Accumulate(
myNewColumnList,
myTable,
(current_table, new_name) =>
if List.Contains(Table.ColumnNames( current_table), new_name)
then current_table
else Table.AddColumn(current_table, new_name, each null)
)
in foo
in myFunc
The solution is working fine.
However instead of putting a null into each row I want to use a calculated value.
Anytime I replace the null in the above code with something like '_ +1' I get an error. (The reference to the current record (_) alone is working). It looks like _ is recognized as a record. I cannot 'hardcode' the name of the first column because this name is not always the same (myNewColumList is passed and can be any list).
My question now is, how to write a formula into that function.
mmbr1606
9
Super User 2025 Season 1
stampcoin
7
SD-13050734-0
6