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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Rank

Need assistance in terms to develop a pivot table with Rank function:

Requirement:

We have a map where we are plotting Rank City wise based on Score.

If a particular user click on a specific city, a pivot table will be shown with the rank of the selected city in comparision to the rest of cities

Data is as follows:

   

YearCityLevel1Level2Level3Level4Score
2015ABCEnbPE & SEPEQ184.62
2015ABCEnbPE & SEPEQ290.35
2015ABCEnbPE & SEPEQ380.00
2015ABCEnbPE & SEEGQ458.82
2015ABCEnbPE & SEEGQ561.21
2015ABCEnbPE & SEEGQ683.07
2015PQREnbPE & SEPEQ134.62
2015PQREnbPE & SEPEQ235.74
2015PQREnbPE & SEPEQ390.00
2015PQREnbPE & SEEGQ460.00
2015PQREnbPE & SEEGQ580.00
2015PQREnbPE & SEEGQ665.00

 

 

Complete Pivot table output:

   

CityLevel1Level2Level3Level4ScoreRank
ABCEnb 76.341
PE & SE 76.341
PE 84.991
Q184.621
Q290.351
Q380.002
EG 67.702
Q458.822
Q561.212
Q683.072
PQREnb 60.891
PE & SE 60.892
PE 53.452
Q134.622
Q235.742
Q390.001
EG 68.331
Q460.001
Q580.001
Q665.001

Final pivot table would show only 1 city at a time i.e based upon the user selection in the map Eg.if City 'ABC' selected follwoing would be the output:

   

CityLevel1Level2Level3Level4ScoreRank
ABCEnb 76.341
PE & SE 76.341
PE 84.991
Q184.621
Q290.351
Q380.002
EG 67.702
Q458.822
Q561.212
Q683.072

I hope I was clear in explaining my query.

Thanks in advance

26 Replies
sunny_talwar

I have not used Dense Rank before, but I read about it a little bit where you would want to see consecutive ranking. From the example I saw here (https://oracle-base.com/articles/misc/rank-dense-rank-first-last-analytic-functions) this might be a little tricky in QlikView's front end. But Rank function allows you to view the rank in few difference ways by using its 2nd and 3rd paramater. Check out the Rank function here: https://help.qlik.com/en-US/qlikview/12.0/Subsystems/Client/Content/ChartFunctions/RankingFunctions/...

Not applicable
Author

Hi Sunny,

I have tried few functions like RangeAvg to get the issue resolved for Competition rank, However not able to embedd our code into it.

Can you please haev a look into it. Attaching the workbook for reference.

Thanks in Advance

sunny_talwar

What is the output you expect now? Can you share the numbers you are looking to get?

Not applicable
Author

Dear Sunny,

Following is the expected O/P.

sunny_talwar

Try this:

Pick(Dimensionality()-1,

Aggr(NODISTINCT Num(Rank(Sum({<City=>}Score), 4)), [Level1], City),

Aggr(NODISTINCT Num(Rank(Sum({<City=>}Score), 4)), [Level2], City),

Aggr(NODISTINCT Num(Rank(Sum({<City=>}Score), 4)), [Level3], City),

Aggr(NODISTINCT Num(Rank(Sum({<City=>}Score), 4)), [Level4], City))

Not applicable
Author

It worked, can you please let me know, how did NUM helped here to achieve our result.

sunny_talwar

Rank gives out a dual output, I just converted the text into number using Num() function. + I used Rank(Expression, 4) to get the consecutive ranks Rank ‒ QlikView