Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Filter Rank By date

Hello Qlik Community!

Below is my output

Qlik community 9.jpg

My current problem is i need to sort the rank based on the date. Currently. The rank on 31/05 is accumulated from the rank on 30/04

Below is my current script

Load

[Factory],

    [Total Complaint Received],

    [Date],

    if([Total Complaint Received] = 0 , 1,

    if([Total Complaint Received] = Previous([Total Complaint Received]) and Previous([Date]) = [Date],

    peek(Rank),

    RecNo())) as Rank,

Resident MainComplaint

Order By [Date],[Total Complaint Received] ;

Can anyone help me solve this problem?

Thank you in advance!

8 Replies
marinadorcassio1
Partner - Creator
Partner - Creator

Hi Muhammad,

Is it really a need to calculate [Rank] in the script ?

Have you tried just to delete this field from your script, and add a measure Rank like Rank(sum([Total Complaint Received]) ?

How is built your table MainComplaint ?


Regards,

Marina

DavidŠtorek
Creator III
Creator III

Hi,

what do you actually want to rank?

  1. Number of total complaint within some date between factories
  2. Number of total complaint within one factory between days

It is not obvious from your script. Maybe first try to use Rank() or HRank() function in front end

    • expression will be Rank(Sum([Total Complaint Received]))
Anonymous
Not applicable
Author

Hi Marina,

Yes i have to create it in the load script because there is one requirement that i need to merge all the rank on all sheet into one final table.

Thank you for your concern!

Anonymous
Not applicable
Author

Hi Mr. David,

I want like to rank this one

  1. Number of total complaint within some date between factories

I need to rank it in the load script because different sheet will have different data and rank. There is one requirement that i need to merge all of the ranks and adding point(s) based on the rank in one final sheet.

or there is another way?

DavidŠtorek
Creator III
Creator III

Hi,

if so than use simply Rank() function in your table. It is not necessary at all to do it in script. Or am I missunderstanding something?

Anonymous
Not applicable
Author

Hi David,

Thank you for your concern.

I used your codes but it turned out the same.

Qlik community 10.PNG

Thanks!

DavidŠtorek
Creator III
Creator III

Hi,

thats why I delete it (it is because of RecNo())... . From my perspective it is best to use Rank() function in your table

Anonymous
Not applicable
Author

Hi,

I'll take your advice! thanks a lot!