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: 
Ania
Contributor
Contributor

Rank in load script (with partition by)

Hi,

I need to rank results in the same way as a rank function does in sql server:

PlatformSiteValueRank
MobileEN3001
MobileIL1502
MobileDE1502
MobilePL1004
PCEN6001
PCIL6001
PCDE4003
PCPL2004
CryptoEN4001
CryptoIL3002
CryptoPL1003
CryptoDE1003

I've already tried:

  • AutoNumber(RowNo(),Platform)  as  Rank
  • AutoNumber(Value,Platform)  as  Rank
  • if(Platform= Previous(Platform), Peek(Rank) + 1, 1)  as  Rank
  • If(Platform= Previous(Platform) and Value= peek(Value), Peek(Rank), if( Platform= Previous(Platform), Peek(Rank) + 1, 1))  as  Rank

with order by Platform, Value

Is there a way to do this in QlikView?

1 Reply
Ania
Contributor
Contributor
Author

I managed to do it:

LOAD *,
If(Platform= Previous(Platform) and Value= peek(Value), Peek(Rank), RowNoTMP) as Rank;
LOAD
*,

if(Platform= Previous(Platform), Peek(RowNoTMP) + 1, 1)  as  RowNoTMP

resident TBL
order by Platform , Value desc;

If You know any better solution, I'll be happy to know it 🙂