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: 
madhushi87
Contributor II
Contributor II

Need to get Straight Table Row Count

Hi,

I want to display a summary of employees who worked more than 61 hours per week in a straight table. 

Below shows the details of employees. 

Capture.JPG

I got worked hours using following query on the expression.

 

=if((Num#(Sum(if((Week(makedate(year(IN_DATE),month(IN_DATE),day(IN_DATE)))=Week(makedate(year(vMinDate),month(vMinDate),day(vMinDate)))),Interval(CHECK_OUTTIME-CHECK_INTIME,'hh'))))>=61)
=-1,Sum(if((Week(makedate(year(IN_DATE),month(IN_DATE),day(IN_DATE)))=Week(makedate(year(vMinDate),month(vMinDate),day(vMinDate)))),Interval(CHECK_OUTTIME-CHECK_INTIME,'hh'))))

But when i try to get the summary in another straight table it doesn't show as i expected. The expected results show as below.

Capture2.JPG 

I tried following query, can anyone please tell me what did i do wrong and how to get the correct count.

if((Num#(Sum(if((Week(makedate(year(IN_DATE),month(IN_DATE),day(IN_DATE)))=Week(makedate(year(vMinDate),month(vMinDate),day(vMinDate)))),Interval(CHECK_OUTTIME-CHECK_INTIME,'hh'))))>=61)
=-1,Count(DISTINCT EMPLOYEE_ID))

Thank You

 

1 Solution

Accepted Solutions
sunny_talwar

You can also try this

Count(DISTINCT
{<
[Employee Id] = {"=Num#(Sum(If(Week(IN_DATE) = Week(vMinDate), Interval(CHECK_OUTTIME - CHECK_INTIME, 'hh')))) >= 61"}
>}
[Employee Id])

View solution in original post

3 Replies
pradosh_thakur
Master II
Master II

sum(if((Num#(Sum(if((Week(makedate(year(IN_DATE),month(IN_DATE),day(IN_DATE)))=Week(makedate(year(vMinDate),month(vMinDate),day(vMinDate)))),Interval(CHECK_OUTTIME-CHECK_INTIME,'hh'))))>=61)
=-1,1,0))
Learning never stops.
sunny_talwar

You can also try this

Count(DISTINCT
{<
[Employee Id] = {"=Num#(Sum(If(Week(IN_DATE) = Week(vMinDate), Interval(CHECK_OUTTIME - CHECK_INTIME, 'hh')))) >= 61"}
>}
[Employee Id])
madhushi87
Contributor II
Contributor II
Author

Thank you for helping me out. Really appreciate your support!!