User Tools

Site Tools


transformations:addcolumn

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
transformations:addcolumn [2015/04/10 14:16] elenaptransformations:addcolumn [2021/03/30 23:07] craigt
Line 1: Line 1:
-===== Calculate new column(s) =====+{{ transformations:AddColumnsAction.png}} 
 +====== CALCULATE NEW COLUMN(S) =====
 +Category: Transform / Basic\\
  
-This transformation calculates one or more new columns using [[syntax:start|expression(s)]]. One expression creates one column.+\\  
 +=====Description===== 
 +This action calculates one or more new columns using [[syntax:start|expression(s)]]. One expression creates one column.
  
-Expression is calculated for every row. Other column values in the same row can be referred by column names in square brackets. It's not possible to refer from one row to another row or to another table.+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 from one row to another row or to another table.
  
-EXAMPLE+Instead of an expression, this action can insert a full column of static text or numeric values.\\ 
 + 
 + 
 +\\ 
 +=====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).| 
 + 
 +\\  
 +=====Examples===== 
 + 
 +**Example:** Calculate the $ amount of compulsory deductions for each country
  
 **Source table:** Average income and deductions **Source table:** Average income and deductions
  
- Country  Gross income    Disposable income  Compulsory deductions +^Country  ^Gross income   ^Disposable income  ^Compulsory deductions 
-| United States  |  56067  |  45582  |  18.7%  +| United States  |  56067|  45582|  18.7%| 
-| Australia  |  51050  |  42617  |  16.52%  +| Australia  |  51050|  42617|  16.52%| 
-| Switzerland  |  53716  |  48414  |  9.87%  +| Switzerland  |  53716|  48414|  9.87%| 
-| Canada  |  45896  |  37469  |  18.36%  |+| Canada  |  45896|  37469|  18.36%|
  
-**Objective:** calculate the amount of compulsory deductions for each country+**Action parameters:** 
 +> New column name: Deductions $ 
 +> Expression: [Gross income] - [Disposable income]
  
-**Transformation parameters:** 
-  * New column name: Deductions $ 
-  * Expression: ([Gross income] - [Disposable income]) 
  
 **Output table:** **Output table:**
  
- Country  Gross income    Disposable income  Compulsory deductions  Deductions $  ^ +^Country  ^Gross income   ^Disposable income  ^Compulsory deductions  ^Deductions $  ^ 
-| United States  |  56067  |  45582  |  18.7%  |  10485  +| United States  |  56067|  45582|  18.7%|  10485| 
-| Australia  |  51050  |  42617  |  16.52%  |  8433  +| Australia  |  51050|  42617|  16.52%|  8433| 
-| Switzerland  |  53716  |  48414  |  9.87%  |  5302  +| Switzerland  |  53716|  48414|  9.87%|  5302| 
-| Canada  |  45896  |  37469  |  18.36%  |  8427  | +| Canada  |  45896|  37469|  18.36%|  8427
- + 
 + 
 + 
 +\\  
 +=====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:replacecolumn|Modify column(s)]] 
 +  * [[transformations:Peek|Peek]] 
 +  * [[transformations:rule|Rule]] 
 +  * [[transformations:subtotal|Total/Subtotals]]
  
-See also 
-  * [[transformations:replacecolumn|Calculate and replace column]] 
transformations/addcolumn.txt · Last modified: 2024/02/05 14:20 by craigt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki