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: 
Anonymous
Not applicable

Aggr? Just count first value in column

Hi All,

I have a list of data that I want to evaluate on just the minimum date value only. I have a list of people who have had tests performed, and these tests should be performed every day on each person during their visit. I want to be able to tell if the person had a test performed within 8 hours of arriving for their visit. If a person had has had multiple tests per visit, how do I just count the first test, and see if that was within 8 hours or arrival? Here's an example of the data:

      

Visit IDPerson IDArrival Date/TimeTest Date/TimeIntervalLess than 8 hours?
2870400711489671/12/2015 20:54:581/12/2015 21:39:520.031180556Yes
2870400711489671/12/2015 20:54:584/12/2015 2:42:552.241631944No
2870400711489671/12/2015 20:54:585/12/2015 3:13:273.262835648No
286933422170671/12/2015 21:02:001/12/2015 22:46:040.072268519Yes
286981144311451/12/2015 21:23:222/12/2015 1:55:140.188796296Yes
2870626611520551/12/2015 21:47:554/12/2015 11:01:402.551215278No
286984656666481/12/2015 21:55:001/12/2015 23:35:570.070104167Yes
286707168746111/12/2015 22:16:052/12/2015 4:53:140.275798611Yes

The count that I would want to achieve here is 5. Five people had a test within 8 hours of arrival (Person 1148967 had 3 tests, but the first one was performed within 8 hours). One did not. Do I perform this using the Aggr function? What would this look like? What if I create a new table in the load script with FirstValue?

Many thanks,

Glen

1 Solution

Accepted Solutions
Anil_Babu_Samineni

My bad?

Count({<[Less than 8 hours] = {Yes}>} [Person ID])

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful

View solution in original post

4 Replies
qliksus
Specialist II
Specialist II

You can use the below

count({<Person ID = {"=interval(test time - Arrival Time,'HH')<8"}>} Person ID )

Anil_Babu_Samineni

If you already calculated "Less than 8 hours" ??

Count({<[]Less than 8 hours = {Yes}>} [Person ID])

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anil_Babu_Samineni

My bad?

Count({<[Less than 8 hours] = {Yes}>} [Person ID])

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
Anonymous
Not applicable
Author

Perhaps I was overthinking this..