Table.AddColumn
A new column named newColumnName is created in the table table. The values for this column are determined by the specified selection function columnGenerator, which uses each row as an input for compu...
Table.AddColumn(table as table, newColumnName as text, columnGenerator as function, optional columnType as nullable type) as table
A new column named newColumnName is created in the table table. The values for this column are determined by the specified selection function columnGenerator, which uses each row as an input for computation.
In the given table, a new column named "TotalPrice" has been added. Each value in this column is calculated as the sum of the values in the [Price] and [Shipping] columns.
To achieve this, the Power Query MTable.AddColumn function was used. The table was created using Table.FromRecords function, with the relevant data records. The TotalPrice column was then added to the table, with values calculated using the formula each [Price] + [Shipping]. The data type for the TotalPrice column was specified as number.
The output is a table that includes the original columns along with the newly added TotalPrice column. Each row in the table displays the OrderID, CustomerID, Item, Price, Shipping, and TotalPrice values for that specific order.