Function that ranks values within a specified group
Function:
Rank_by_Group(table = string, value = string, cols = [string], new_col = string, method = string)
Parameters:
Table: Table name that you wish to describe
Value: Value by which to rank the group
Cols: Columns to create grouping
New_col: New column name for the ranks to return
Method: How you want to rank the values (average, min, max, first, dense)
-
-
average: average rank of group.
-
min: lowest rank in group.
-
max: highest rank in group.
-
first: ranks assigned in order they appear in the array.
-
dense: like ‘min’, but rank always increases by 1 between groups.
-
Examples:
Rank_by_Group(table = Nov Snap, value = MRR, cols = [Product Name], new_col = Rank by Product, method = first)