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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
farheenayesha
Creator
Creator

How to rank duplicate values

Hi,

     I want to rank duplicate values with the same rank. Please find the data and expression below.

   

Region% to PYRank
Region 1107%1
Region 2104%2
Region 3103%3
Region 4101%4
Region 5102%5
Region 6100%6
Region 7100%6
Region 8100%6
Region 999%7
Region 1099%7
Region 1198%8
Region 1297%9

Expression:

% to PY : Sum({<[Region Name]=>} [Sales Amount])/sum({<[Region Name]=>} [Prior Year Sales Amount])

Rank: Only({<[Region Name]={"Region 6"}>} Aggr(Rank(Sum({<[Region Name]=>} [Sales Amount])/sum({<[Region Name]=>} [Prior Year Sales Amount])), [Region Name]))

However with above Rank expression i am getting Rank as 7 for Region_7. But i want to get the rank as 6 for Region_7. Please help me. @

2 Replies
petter
Partner - Champion III
Partner - Champion III

The Rank() function can take more than one parameter. With additional parameters you can control exactly how you want the ranking to be done:

https://help.qlik.com/en-US/qlikview/November2017/Subsystems/Client/Content/ChartFunctions/RankingFu...

Note especially the second parameter named "mode" in the documentaion.

stevedark
Partner Ambassador/MVP
Partner Ambassador/MVP

Just in case it is still useful to anyone, my solution over here may help with this one also:

https://community.qlik.com/t5/App-Development/Change-row-color-when-change-value/m-p/1936581#M77196

You just need to add to the CONCAT statement a sort weight of the expression you are ranking on and it should work.

Cheers,

Steve