User Tools

Site Tools


transformations:subtotal

Differences

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

Link to this comparison view

Next revision
Previous revision
transformations:subtotal [2018/07/22 16:00] – created dmitrytransformations:subtotal [2022/10/02 20:15] (current) – update action category craigt
Line 1: Line 1:
-===== Total subtotals =====+{{ transformations:SubtotalAction.png}} 
 +====== TOTAL/SUBTOTALS =====
 +Category: Transform / Advanced\\
  
-This action appends to a dataset a new column that contains an aggregated total for selected column, or subtotals for groups.+\\  
 +=====Description===== 
 +This action appends to a dataset a new column that contains an aggregated total for selected column, or subtotals for groups.\\
  
-**Example 1**+\\ 
 +=====Use cases===== 
 +Create a "total" column to calculate a total or group percentage value with (e.g. total value/ group value).\\
  
-Source dataset:+ 
 +\\  
 +=====Action settings===== 
 +^Setting^Description^ 
 +|New column|Enter a name for the new total/subtotal column.| 
 +|Target column|Select the numeric column used to generate the aggregate values.| 
 +|Mode|Select the aggregation mode.  Options:  //Sum//, //Count//, //Average//, //Min//, and //Max//.| 
 +|Groups|Select whether to derive the total/subtotal value across all rows in the dataset, or grouped by selected columns.\\  Options:  //Column total// or //Subtotal inside groups// (and select the columns to subtotal by).| 
 +\\  
 +=====Remarks===== 
 +The new column will appear as the rightmost column in the dataset, by default. 
 + 
 +The grouping aspect of the //Subtotal inside groups// option is case-sensitive.  Values in the grouping column(s) having different cases will be calculated as unique values (e.g. not combined).\\ 
 + 
 +\\  
 +=====Examples===== 
 +**Example 1:**  Add a column with Total Sales.\\ 
 + 
 +**Source table:**
 ^ Region ^ Sales ^ ^ Region ^ Sales ^
 | North  |  100 | | North  |  100 |
Line 11: Line 35:
 | North  |  150 | | North  |  150 |
 | East    125 | | East    125 |
- +\\  
-Objectiveadd a column with Total Sales. +**Action parameters:** 
- +> New column is "Total Sales
-Resulting dataset:+> Target column is "Sales" 
 +> Mode is "Sum" 
 +> Groups is "Column total" 
 +\\  
 +**Result table:**
 ^ Region ^ Sales ^ Total Sales ^ ^ Region ^ Sales ^ Total Sales ^
 | North  |  100 |   575 | | North  |  100 |   575 |
Line 21: Line 49:
 | East    125 |   575 | | East    125 |   575 |
  
-**Example 2**+\\  
 +\\  
 +**Example 2:**  Add a column with Total By Region.\\
  
-Source dataset:+**Source table:**
 ^ Region ^ Sales ^ ^ Region ^ Sales ^
 | North  |  100 | | North  |  100 |
Line 29: Line 59:
 | North  |  150 | | North  |  150 |
 | East    125 | | East    125 |
- +\\  
-Objectiveadd a column with Total By Region. +**Action parameters:** 
- +> New column is "Total by Region" 
-Resulting dataset:+> Target column is "Sales" 
 +> Mode is "Sum" 
 +> Groups is "Subtotal inside groups" (column "Region" selected) 
 +\\  
 +**Result table:**
 ^ Region ^ Sales ^ Total By Region ^ ^ Region ^ Sales ^ Total By Region ^
 | North  |  100 |   250 | | North  |  100 |   250 |
Line 39: Line 73:
 | East    125 |   325 | | East    125 |   325 |
  
-**See also**+\\  
 +====Community examples==== 
 +  [[https://community.easymorph.com/t//1769/1|How to do recursive loops in EasyMorph]] ([[https://community.easymorph.com/uploads/short-url/qM6kmqrDRWiEDJFljIa2u6QWre1.morph|Project]]; Module: //Module 1//; Group: //Tab 1//; Table: //Table 1//; Action position: //3//) 
 +  [[https://community.easymorph.com/t//1837/4|Joining different pairs of value equivalences into “global equivalences”]] ([[https://community.easymorph.com/uploads/short-url/1TpBXIjf6r4auDHlOBejKh2rSTw.morph|Project]]; Module: //Group//; Group: //Tab 1//; Table: //Input//;\\ Action position: //2//) 
 +  [[https://community.easymorph.com/t//2505/2|Check a column for unique and/or duplicate values and group by non-unique values]] ([[https://community.easymorph.com/uploads/short-url/7s9tWfHaseZ9EqSBdVmjSfGagIS.morph|Project]]; Module: //Main//; Group: //Group 1//;\\ Table: //Identify the number of accounts//; Action position: //4//)
  
 +\\ 
 +=====See also=====
   * [[transformations:aggregate|Aggregate]]   * [[transformations:aggregate|Aggregate]]
transformations/subtotal.1532289654.txt.gz · Last modified: 2018/07/22 16:00 by dmitry

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki