Rank Column#
Description:
Ranks all values in a column based on the method chosen.
Function:
Rank(table = string, col = string, new_col = string, method = string)
Parameters:
Table: Table name on which to perform function
Column (col): Column to perform Rank
Method: How to rank the group of records that have the same value
average Assigns the average of the ranks that would have been assigned to the tied values.
min: Assigns the smallest rank to all tied values.
max: Assigns the largest rank to all tied values.
ordinal: Assigns unique, consecutive ranks based on the order of the elements. Ties are ranked sequentially without considering their equality.
dense: Similar to min, but the ranks are consecutive integers without skipping values for ties.
New Column Name: Name for new column
Example:
Rank(table = Budget, col = "Actual", method = "average", new_col = "Rank Avg")
Date |
Geo |
Business |
Plan |
Actual |
|---|---|---|---|---|
8/1/2024 |
Asia-Pacific |
Energy |
800 |
750 |
7/1/2024 |
Middle East & A |
Healthcare |
1200 |
900 |
5/1/2024 |
Latin America |
Manufacturing |
900 |
900 |
9/1/2024 |
Asia-Pacific |
Technology |
1500 |
1300 |
11/1/2024 |
Latin America |
Energy |
2000 |
1800 |
Date |
Geo |
Business |
Plan |
Actual |
Rank |
|---|---|---|---|---|---|
8/1/2024 |
Asia-Pacific |
Energy |
800 |
750 |
1.0 |
7/1/2024 |
Middle East & A |
Healthcare |
1200 |
900 |
2.5 |
5/1/2024 |
Latin America |
Manufacturing |
900 |
900 |
2.5 |
9/1/2024 |
Asia-Pacific |
Technology |
1500 |
1300 |
4.0 |
11/1/2024 |
Latin America |
Energy |
2000 |
1800 |
5.0 |
Date |
Geo |
Business |
Plan |
Actual |
Rank |
|---|---|---|---|---|---|
8/1/2024 |
Asia-Pacific |
Energy |
800 |
750 |
1 |
7/1/2024 |
Middle East & A |
Healthcare |
1200 |
900 |
2 |
5/1/2024 |
Latin America |
Manufacturing |
900 |
900 |
2 |
9/1/2024 |
Asia-Pacific |
Technology |
1500 |
1300 |
4 |
11/1/2024 |
Latin America |
Energy |
2000 |
1800 |
5 |
Date |
Geo |
Business |
Plan |
Actual |
Rank |
|---|---|---|---|---|---|
8/1/2024 |
Asia-Pacific |
Energy |
800 |
750 |
1 |
7/1/2024 |
Middle East & A |
Healthcare |
1200 |
900 |
3 |
5/1/2024 |
Latin America |
Manufacturing |
900 |
900 |
3 |
9/1/2024 |
Asia-Pacific |
Technology |
1500 |
1300 |
4 |
11/1/2024 |
Latin America |
Energy |
2000 |
1800 |
5 |
Date |
Geo |
Business |
Plan |
Actuals |
Rank |
|---|---|---|---|---|---|
8/1/2024 |
Asia-Pacific |
Energy |
800 |
750 |
1 |
7/1/2024 |
Middle East & A |
Healthcare |
1200 |
900 |
2 |
5/1/2024 |
Latin America |
Manufacturing |
900 |
900 |
3 |
9/1/2024 |
Asia-Pacific |
Technology |
1500 |
1300 |
4 |
11/1/2024 |
Latin America |
Energy |
2000 |
1800 |
5 |
Date |
Geo |
Business |
Plan |
Actual |
Rank |
|---|---|---|---|---|---|
8/1/2024 |
Asia-Pacific |
Energy |
800 |
750 |
1 |
7/1/2024 |
Middle East & A |
Healthcare |
1200 |
900 |
2 |
5/1/2024 |
Latin America |
Manufacturing |
900 |
900 |
2 |
9/1/2024 |
Asia-Pacific |
Technology |
1500 |
1300 |
3 |
11/1/2024 |
Latin America |
Energy |
2000 |
1800 |
4 |