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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
K7pramod
Contributor III
Contributor III

How to get row count for a group order by date

Hello,

Can anyone help me with equivalent Qlik Sense code(LOAD statement) for the below SQL 

ROW_NUMBER() over (PARTITION by APP_HOST_SYSTEM,CAST(MSG_DATETIME as DATE) ORDER BY DURATION) as RowNum

I need a incremental number for the group APP_HOST_SYSTEM and MSG_DATETIME order by DURATION, this is to find the top delayed responses with 90th 95th percentile.
the table has these columns -
APP_HOST_SYSTEM,
MSG_DATETIME,

DURATION

 

Labels (1)
21 Replies
vinieme12
Champion III
Champion III

two options

Option1) Autonumber()

,AutoNumber(APP_HOST_SYSTEM&date&DURATION,APP_HOST_SYSTEM) as rownum

 

Option2) Peek(), needs table to be sorted

Temp:

Load * from SomeTable;

 

Final:

Load *

,if(APP_HOST_SYSTEM=peek('APP_HOST_SYSTEM') and date=peek('date'),peek('rownum2')+1,1) as rownum2

Resident Temp

Order by APP_HOST_SYSTEM,date,DURATION;

 

 

 

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
K7pramod
Contributor III
Contributor III
Author

@vinieme12  thanks a lot for your efforts and time. the solution worked and i am able to get the row numbers correct with below code.

Final:

Load *

,if(APP_HOST_SYSTEM=peek('APP_HOST_SYSTEM') and date=peek('date'),peek('rownum2')+1,1) as rownum2

Resident Temp

Order by APP_HOST_SYSTEM,date,DURATION;