What is the best way to pass all cells in a table the same value?
For instance, if I start with this table:
How might I most easily change it to this:
Or to this:
I would like the solution to work for any size table, without having to hard-code the columns' names. So I'm pretty sure the solution will include Table.ColumnNames.
My suggestion would be to create a new table with the dimensions and table type of the original table. The table type includes column names and column data types (and any keys if these would be present).
Note: this won't work if the original table has a primary key, e.g. after removing duplicates.
let
NewValue = "a",
Source = Table1,
NewTable = Table.FromColumns(List.Repeat({List.Repeat({NewValue},Table.RowCount(Source))},Table.ColumnCount(Source)), Value.Type(Source))
in
NewTable