Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to find top2 voilation in working flag

hi,qlikers

i attached some sample data in that i need to find top2 violation employees

how can i find this

Thanks in advanse

Regards

Hemesh

1 Solution

Accepted Solutions
PradeepReddy
Specialist II
Specialist II

Try this...

=Concat(if(aggr(rank(count({<WorkingFlag={'Voilation'}>}[Employee id])),[Employee id])<=2,[Employee Name]),'|')

View solution in original post

5 Replies
sunny_talwar

Are you trying to do this in the script or UI of the application?

MK_QSL
MVP
MVP

You have to use Rank Function !

sunny_talwar

May be something like this in the script:

Table:

LOAD [Employee id],

    Date,

    [Employee Name],

    WorkingFlag,

    Duration

FROM

EmployeeDatails.xlsx

(ooxml, embedded labels, table is Sheet1);

Temp:

LOAD [Employee id],

  Count(WorkingFlag) as Count

Resident Table

Where WorkingFlag = 'Voilation'

Group By [Employee id];

Join(Table)

LOAD [Employee id],

  Count,

  AutoNumber(Count) as Rank

Resident Temp

Order By Count desc;

DROP Table Temp;

Output in straight table:

Capture.PNG

Not applicable
Author

in ui i want to find and here the fields are from different tables  Employee id,name are from employee table date is from master calendar and duration,workingflag are from final table

PradeepReddy
Specialist II
Specialist II

Try this...

=Concat(if(aggr(rank(count({<WorkingFlag={'Voilation'}>}[Employee id])),[Employee id])<=2,[Employee Name]),'|')