Search notes:

Power Query M formula language standard library: Table.AddColumn

Table.AddColumn(TABLE as table, NEWCOLUMNNAME as text, COLUMNGENERATOR as function, optional COLUMNTYPE as nullable type) as table
Table.AddColumn adds a new column to a table by calling COLUMNGENERATOR on each record. The returned value of COLUMNGENERATOR becomes the column's new value.
Example:
let
   tab = #table(
    { "id", "val 1", "val 2"}, {
     {  1 , "abc"  ,   1111 },
     {  2 , "def"  ,     22 },
     {  3 , "ghi"  ,    333 }
   }),
   tab_ = Table.AddColumn(tab, "size", each
      if      [val 2] > 1000 then "large"
      else if [val 2] >  100 then "medium"
      else                        "small"
   )
in
   tab_

See also

The Power Query standard library and its function Table.CombineColumns.

Index