ADDCOLUMNS

Description

The ADDCOLUMNS function adds additional columns to a specified table. The result of the function is a new table that includes the original columns of the source table, plus the new columns.

Usage

ADDCOLUMNS(Table, "New Name 1", COLUMN_EXPR1, "New Name 2", COLUMN_EXPR2, ...)

The first argument must be a table expression, such as form id or another table function.

Following the table argument, the function accepts pairs of column names and expressions. Each pair results in an additional column in the resulting table.

Examples

Converting currencies

Suppose you have the following table with records containing the amounts for loans issued denominated in Euros.

Loan ID Loan amount in EUR
LOAN-2023-001 1000
LOAN-2023-002 1500
LOAN-2023-003 2000

Say that you will need to analyze this data in US dollars. You can use ADDCOLUMNS to add a column to this table that contains the converted amount.

Assuming that the exchange rate to apply across all loans is 1.1, your formula would be:

ADDCOLUMNS([Loans], “Loan amount in USD”, [Loan amount in EUR]*1.1)

Resulting Table

Loan ID Loan amount in EUR Loan amount in USD
LOAN-2023-001 1000 1100
LOAN-2023-002 1500 1650
LOAN-2023-003 2000 2200

The resulting table will include the existing columns from [Loans] and a new column "Loan amount in USD" calculated as the product of the loan amount in euros and the exchange rate you set in your formula.

Next item
GREAT_CIRCLE