Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor
Contributor

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
Highlighted

Re: Aggr? Just count first value in column

My bad?

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

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

View solution in original post

4 Replies
Highlighted
Specialist II
Specialist II

Re: Aggr? Just count first value in column

You can use the below

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

Highlighted

Re: Aggr? Just count first value in column

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

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

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)
Highlighted

Re: Aggr? Just count first value in column

My bad?

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

Before develop something, think If placed (The Right information | To the right people | At the Right time | In the Right place | With the Right context)

View solution in original post

Highlighted
Contributor
Contributor

Re: Aggr? Just count first value in column

Perhaps I was overthinking this..