transformations:addcolumn
Table of Contents
CALCULATE NEW COLUMN(S)
Category: Transform / Basic
Description
This action calculates one or more new columns using expression(s). One expression creates one column.
Use cases
- Creating a calculated result from numeric values in two (or more) other columns.
- Concatenating text values from two (or more) other columns.
- Creating a full-column list of the same text or numeric value.
Action settings
Setting | Description |
---|---|
New column name | Enter the name of the new column. |
Expression or Value | Options: It's an expression or It's a text or number. Enter the expression used to calculate the new column values, or, enter the text or numeric value that will be repeated for all values. |
Position | Choose where the new column(s) will appear in the dataset. Options: Rightmost, Leftmost, or After column (and select the column the new column(s) will appear after). |
If column already exists | Choose how EasyMorph reacts if the new column name already exists in the dataset. Options: Rename new column (a sequential number is appended to the column name), Do not create new column (the column is not created and the workflow continues), or Fail (the action displays an error and the workflow stops). |
Remarks
The expression is calculated for every row. Other column values in the same row can be referred to by column names in square brackets. It's not possible to refer to other rows or tables.
Instead of an expression, this action can insert a full column of static text or numeric values.
Subsequent expressions can reference columns previously created within the same Calculate new column(s) action. (See example, below)
Examples
Example #1
Calculate the $ amount of compulsory deductions for each country
Before (source table)
Average income and deductions
Country | Gross income | Disposable income | Compulsory deductions |
---|---|---|---|
United States | 56067 | 45582 | 18.7% |
Australia | 51050 | 42617 | 16.52% |
Switzerland | 53716 | 48414 | 9.87% |
Canada | 45896 | 37469 | 18.36% |
After (result table)
Country | Gross income | Disposable income | Compulsory deductions | Deductions $ |
---|---|---|---|---|
United States | 56067 | 45582 | 18.7% | 10485 |
Australia | 51050 | 42617 | 16.52% | 8433 |
Switzerland | 53716 | 48414 | 9.87% | 5302 |
Canada | 45896 | 37469 | 18.36% | 8427 |
Action parameters:
New column name: Deductions $
Expression: [Gross income] - [Disposable income]
Community examples
- Split Excel spreadsheets into multiple spreadsheets (Project; Module: Main; Group: Tab 1; Table: Spreadsheet A.xlsx;
Action position: 3) - How to split Number and Alphabetical Characters from a Cell (Project; Module: Main; Group: Tab 1; Table: Table 1; Action position: 2)
- How to calculate YoY change using self-join (Project; Module: Main; Group: Self-join; Table: This year; Action position: 4)
- How to format the duration in more than 24h (Project; Module: Main; Group: Tab 1; Table: Table 1; Action position: 6)
- Split after last space (Project; Module: Main; Group: Tab 1; Table: Table 1; Action position: 2)
- Search, remove, and shift (Project; Module: Main; Group: Regrouping; Table: ExtractingData.xlsx; Action position: 5)
- Split text into columns problem - split when data changes from text to numbers (Project; Module: Main; Group: Group 1;
Table: Variant 1; Action position: 2)
Shortcuts
Fast ways to create the action:
- Right-click on a column heading, and select "Insert column(s)".
- Click the drop-down arrow in a column heading and select "Insert column(s)".
In either case, a new column with a default column name will appear after the selected column.
See also
transformations/addcolumn.txt · Last modified: 2025/01/09 07:54 by yurii