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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
korn_th1
Contributor II
Contributor II

Summary count Top N from specific date

Dear All Qlik Guru

Please Help me

I have Job period 10 Day.

I want summary top 10 dept. from select CALENDAR DATE and how many day of that dept.

Sample:

If I Select 5/8/2017 - 9/8/2017

Dept. Top 10 Job each day and Summary count day in top 10

Thank you for all your assistance

sample.PNG

1 Solution

Accepted Solutions
sunny_talwar

Try this

Dimension

DEPT.

Expression

=Sum(Aggr(If(Div(Index('-' & Concat(DISTINCT TOTAL <CALENDAR_DATE> Num(Aggr(Rank(Count(JOB_NUMBER),1,1),CALENDAR_DATE, DEPT.), '00000'), '-', -Aggr(Count(JOB_NUMBER), CALENDAR_DATE, DEPT.)), Num(Rank(Count(JOB_NUMBER),1,1), '00000')), 6) + 1 <= 10, 1, 0), CALENDAR_DATE, DEPT.))

Capture.PNG

Look here for the way I derive the ranking

Continuous Ranking (no missing Rank)

View solution in original post

4 Replies
karthikoffi27se
Creator III
Creator III

Hi Korn,

In the Dimension, for the Top 10 job each day please use.

=Aggr(If(Rank(Aggr(Count(Job_ID),Calendar_Date)<10, Job_ID),Calendar_Date)

And in the measure you can use the count function to count the days.

Many Thanks

Karthik

sunny_talwar

Try this

Dimension

DEPT.

Expression

=Sum(Aggr(If(Div(Index('-' & Concat(DISTINCT TOTAL <CALENDAR_DATE> Num(Aggr(Rank(Count(JOB_NUMBER),1,1),CALENDAR_DATE, DEPT.), '00000'), '-', -Aggr(Count(JOB_NUMBER), CALENDAR_DATE, DEPT.)), Num(Rank(Count(JOB_NUMBER),1,1), '00000')), 6) + 1 <= 10, 1, 0), CALENDAR_DATE, DEPT.))

Capture.PNG

Look here for the way I derive the ranking

Continuous Ranking (no missing Rank)

korn_th1
Contributor II
Contributor II
Author

Hi Karthik
Thanks you very much for you scirpt

I test This scirpt but it is error

Error calculate.png

korn_th1
Contributor II
Contributor II
Author

Dear Sunny

Thanks you very much. Thanks you very much.

Excellent Script.