Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set analysis help

I have problem writing set-anlaysis in correct way and hope anyone can help me here.

Here is my dataset:

   

PersondateYes/no
12017-01-01Yes
12017-01-02No
12017-01-03Yes
12017-01-04No
22017-01-01Yes
22017-01-02No
22017-01-03Yes
22017-01-04No
22017-01-05No
22017-01-06Yes
32017-01-01No
32017-01-02Yes
32017-01-03No
32017-01-04Yes
42017-01-05No
42017-01-06No
42017-01-07Yes
42017-01-08No

what I want to do is to get % how many persons hade yes on the latest date within the daterange 2017-01-01  to 2017-01-03

The answer here should be 67%

1 Solution

Accepted Solutions
antoniotiman
Master III
Master III

Hi Liivi,

try

Count(If(Aggr(FirstSortedValue({<date={'>=01-01-2017<=03-01-2017'}>} Yesno,-date),Person)='Yes',1))
/Count(Aggr(FirstSortedValue({<date={'>=01-01-2017<=03-01-2017'}>} Yesno,-date),Person))

Regards,

Antonio

View solution in original post

6 Replies
tresesco
MVP
MVP

Try like:

=Count({<[Yes/no]={Yes},Date={"$(=Date(Max({<Date={'>=01/01/2017<=03/01/2017'}>}Date)))"}>}[Yes/no])

  /

  Count({<Date={"$(=Date(Max({<Date={'>=01/01/2017<=03/01/2017'}>}Date)))"}>}[Yes/no])*100


Capture.PNG

Not applicable
Author

The result is:

   

Date Person Yes/no expr
03/01/20171Yes1
2Yes1
3No1

The result should be posts yellowmarked!

I thing there should be aggr function per person somewhere...

Not applicable
Author

It should be the latest date per person within the daterange  not the latest date ever....

Not applicable
Author

Now all the persons had  a det on 2017-01-03 but if there is a fitfth person:

   

Person
dateYes/no
12017-01-01Yes
12017-01-02No
12017-01-03Yes
12017-01-04No
22017-01-01Yes
22017-01-02No
22017-01-03Yes
22017-01-04No
22017-01-05No
22017-01-06Yes
32017-01-01No
32017-01-02Yes
32017-01-03No
32017-01-04Yes
42017-01-05No
42017-01-06No
42017-01-07Yes
42017-01-08No 
52017-01-01No
52017-01-02Yes
antoniotiman
Master III
Master III

Hi Liivi,

try

Count(If(Aggr(FirstSortedValue({<date={'>=01-01-2017<=03-01-2017'}>} Yesno,-date),Person)='Yes',1))
/Count(Aggr(FirstSortedValue({<date={'>=01-01-2017<=03-01-2017'}>} Yesno,-date),Person))

Regards,

Antonio

Not applicable
Author

Thanx @Antonio Mancini  It solved my problem!!!!