Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
krish2459
Creator
Creator

Rank

Hi ,

 

I need to derive the rank in the below format.

Highlighted column is the desired out put.

 

Row LabelsSum of WeightedNormal RankRequired Rank
Falkland Islands111
Montserrat111
Anguilla2.7781512523
Cayman Islands2.7781512523
Dominica2.7781512523
Saint Kitts and Nevis2.7781512523
Saint-Martin2.7781512523
Grenada3.7781512538
Qatar3.7781512538
Saint Vincent and Grenadines4.455773409410
Caribbean Netherlands4.556302501511
United Arab Emirates4.77815125612
Aruba6.430300856713
Virgin Islands7.023499423814
Bahamas7.23392466915
Turks and Caicos Islands9.4780981861016
Labels (1)
12 Replies
Kushal_Chawda

@krish2459  try below

Armed_Conflict_Temp:
LOAD
sub_event_type,
event_type,
interaction,
region,
trim(upper(country)) as Country,
trim(upper(country)) as Country4,
admin1,
fatalities
FROM [lib://ISC_Data (code1_320001959)/Projects/Secuity Analytics/Risk Management/Development/QVDs/Armed Conflict/Armed Conflict.qvd]
(qvd)where Len(trim(location))>0;

join

Load sub_event_type,Country,
if(sum(fatalities)>0,2,1) as EventWeight,
if(sum(fatalities)>0,2,1)*sum(interaction) as "Event Weightage"
Resident Armed_Conflict_Temp Group by sub_event_type,Country;

Left join
LOAD Distinct Country,
              "Event Weightage",
              If("Event Weightage" = Previous("Event Weightage" ), Peek('Required Rank'), RangeSum(Peek('Required Rank'), 1)) as [Required Rank]
Resident Armed_Conflict_Temp
Order by  "Event Weightage";
krish2459
Creator
Creator
Author

Hi,

I got the atached output after using te below code.

Armed_Conflict_Temp:
LOAD
sub_event_type,

event_type,

interaction,
region,
trim(upper(country)) as Country,
trim(upper(country)) as Country4,
admin1,

fatalities

FROM [lib://ISC_Data (code1_320001959)/Projects/Secuity Analytics/Risk Management/Development/QVDs/Armed Conflict/Armed Conflict.qvd]
(qvd)where Len(trim(location))>0;

join


Load sub_event_type,Country,
if(sum(fatalities)>0,2,1) as EventWeight,
if(sum(fatalities)>0,2,1)*sum(interaction) as "Event Weightage"

Resident Armed_Conflict_Temp Group by sub_event_type,Country;


Armed_Conflict:
LOAD *,
RangeSum(Peek('tmpRank'), 1) as tmpRank,
If("Event Weightage" = Previous("Event Weightage"), Peek('Required Rank'), RangeSum(Peek('tmpRank'), 1)) as [Required Rank]
Resident Armed_Conflict_Temp

Order By "Event Weightage";

DROP Table Armed_Conflict_Temp;
DROP Field tmpRank;

 

It seems countrys has multiple ranks.

 

Please check once.

 

 

sunny_talwar

@krish2459 What you have attached is what you want or is this something you get and is not what you want?