User Tools

Site Tools


transformations:runningtotal

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
transformations:runningtotal [2019/04/16 13:32] dmitrytransformations:runningtotal [2022/10/02 20:14] (current) – update action category craigt
Line 1: Line 1:
-===== Running total =====+{{ transformations:RunningTotalAction.png}} 
 +====== RUNNING TOTAL ====== 
 +Category: Transform / Advanced\\
  
-This transformation calculates rank, cumulative count, sum or % from total sum for a given column inside groups, or table-wide.+\\  
 +=====Description===== 
 +This action calculates rank (ascending and descending), cumulative count, sumor % from the total sum for a given column inside groups, or table-wide.
  
-EXAMPLE+\\ 
 +=====Use cases===== 
 +  *Calculate a running total of sales by time period (weekly, monthly, or annually). 
 +  *Generate the order of completion in a timed event/competition (rank by time value).
  
-**Source table:** The longest rivers in the world 
  
- River   Length(km)  ^  Continent  +\\  
-Nile   6650  |  Africa  +=====Action settings===== 
-Amazon   6400  |  South America  +^Setting^Description
-Yangtze  |  6300   Asia  | +|New column|Enter a name for the new column.
-Mississippi  |  6275  |  North America  | +|Target column|Select the column used to generate the selected values.
-| Yenisei  |  5539  |  Asia  | +|Mode|Select the mode.  Options:  //Rank//, //Rank descending//, //Count//, //Cumulative sum//, and //Cumulative % from total// When selecting\\ "Rank" or "Rank descending", you will also need to select the //Rank mode// See the table below for details.
-| Yellow River   5464  |  Asia  | +|Groups|Select whether to derive the running values across all rows in the dataset, or grouped by selected columns.\\  Options:  //No groups// or //Reset total inside groups// (and select the columns to reset the total by).
-Ob   5410  |  Asia  +\\  
-Paraná   4880  |  South America  |+====Rank modes==== 
 +^Rank mode  ^Description  ^ 
 +|Dense rankingIn dense ranking, values that are equal receive the same ranking number, and the next item(s) receive the ranking\\ number immediately following. E.g. 1,2,2,2,3.
 +|Competition ranking|In competition ranking, values that are equal receive the same ranking number, and a gap is left in the ranking\\ numbers. The number of ranking numbers that are left out in this gap is one less than the number of items that\\ are equal. E.g. 1,2,2,2,5.|
  
-**Objective:** Rank rivers on each continent by length.+\\ 
 +=====Remarks===== 
 +The //Rank//, //Rank descending// and //Count// modes can be applied to columns with text values.  Rank and Rank descending will be based on the alphabetic order of the values while //Count// will simply provide a cumulative count of the text values down the column.
  
-**Transformation parameters:**+\\  
 +=====Examples===== 
 +**Example:** Rank rivers on each continent by length.\\
  
-  Mode: Rank descending +**Source table:** The longest rivers in the world
-  Group by: Continent +
- +
-**Output table:** +
-^  River  ^  Length(km)  ^  Continent  ^  Rank  ^ +
-| Nile  |  6650  |  Africa  |  1| +
-| Amazon  |  6400  |  South America  |  1| +
-| Yangtze  |  6300  |  Asia  |  1| +
-| Mississippi  |  6275  |  North America  |  1| +
-| Yenisei  |  5539  |  Asia  |  2| +
-| Yellow River  |  5464  |  Asia  |  3| +
-| Ob  |  5410  |  Asia  |  4| +
-| Paraná  |  4880  |  South America  |  2| +
- +
-**Ranking modes**+
  
-Note that ranking can be done in one of two modes that return different results in cases when some column values occur more than once:+^River  ^Length(km)  ^Continent 
 +| Nile  |  6650|Africa 
 +| Amazon  |  6400|South America 
 +| Yangtze  |  6300|Asia 
 +| Mississippi  |  6275|North America 
 +| Yenisei  |  5539|Asia 
 +| Yellow River|  5464|Asia 
 +| Ob  |  5410|Asia 
 +| Paraná  |  4880|South America 
 +\\  
 +**Action parameters:** 
 +> Mode is "Rank descending" 
 +> Group by Continent 
 +\\  
 +**Result table:** 
 +^River  ^Length(km)  ^Continent  ^Rank  ^ 
 +|Nile  |  6650|Africa  |  1| 
 +|Amazon  |  6400|South America  |  1| 
 +|Yangtze  |  6300|Asia  |  1| 
 +|Mississippi  |  6275|North America  |  1| 
 +|Yenisei  |  5539|Asia  |  2| 
 +|Yellow River  |  5464|Asia  |  3| 
 +|Ob  |  5410|Asia  |  4| 
 +|Paraná  |  4880|South America  |  2|
  
-//Dense ranking// - In dense ranking, items that compare equally receive the same ranking number, and the next item(sreceive the immediately following ranking number. E.g. 1,2,2,2,3.+\\  
 +====Community examples=== 
 +  * [[https://community.easymorph.com/t//1312/2|A way to obtain all positions of a char in text]] ([[https://community.easymorph.com/uploads/short-url/2lIBiIZXyCaizzyOl1nTkfleYfL.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Table 2//; Action position: //5//) 
 +  * [[https://community.easymorph.com/t//2053/9|Converting Text to HTML]] ([[https://community.easymorph.com/uploads/short-url/3acTPpAroyvp3DsTPNTOZQIqaHO.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Build HTML (alternative)//; Action position: //6//) 
 +  * [[https://community.easymorph.com/t//2646/4|Iterate same row in table a known number of times]] ([[https://community.easymorph.com/uploads/short-url/vfoRlVfxozi5f8GpH7ISOtSsquO.morph|Project]]; Module: //Main//; Group: //Group 1//; Table: //Table 1//; Action position: //4//)
  
-//Competition ranking// - In competition ranking, items that compare equal receive the same ranking number, and then a gap is left in the ranking numbers. The number of ranking numbers that are left out in this gap is one less than the number of items that compared equal.  E.g. 1,2,2,2,5.+\\  
 +=====See also===== 
 +  * [[transformations:subtotal|Total/subtotals]]
  
-The ranking mode can be specified in the action settings. 
transformations/runningtotal.1555435928.txt.gz · Last modified: 2019/04/16 13:32 by dmitry

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki