Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
RMMFCA
Contributor II
Contributor II

Count How Many Have A Specific Range Of Values

I am trying to create an expression within Qlik Sense that counts all the users that satisfy a condition. What I mean is below I have a pivot table that contains data and a list of users and whether they passed a class or not. I need a count of only the students that have passed all classes. So in the chart below, it would be 3.

Class185321998419983
Student   
Mark M.PassPassPass
Richard S.PassPassPass
Gary D.PassPassPass
Bryan J.PassPassLaunched

 

I've tried several methods, but they aren't working. Below are a couple of examples that I've tried but they aren't working. Any help would be appreciated.

COUNT(DISTINCT {< class= {'18532', '19984', '19983'}, status= {'Pass'}>} student)

COUNT
     (DISTINCT
          IF
               (
                       WILDMATCH(class, '14063', '15673') AND status= 'Pass'
                       , student
                )
     )

Labels (2)
1 Solution

Accepted Solutions
jwjackso
Specialist III
Specialist III

using the data below:

Data:
Load * Inline [
class,student,status
18532,M,Pass
18532,R,Pass
18532,G,Pass
18532,B,Pass
19984,M,Pass
19984,R,Pass
19984,G,Pass
19984,B,Pass
19983,M,Pass
19983,R,Pass
19983,G,Pass
19983,B,Fail
];

 

The P() function and asterisck creates an intersection of the results

=Count({<student=P({<class={18532},status={'Pass'}>}student)*P({<class={19984},status={'Pass'}>}student)*P({<class={19983},status={'Pass'}>}student)>}Distinct student)

 

View solution in original post

1 Reply
jwjackso
Specialist III
Specialist III

using the data below:

Data:
Load * Inline [
class,student,status
18532,M,Pass
18532,R,Pass
18532,G,Pass
18532,B,Pass
19984,M,Pass
19984,R,Pass
19984,G,Pass
19984,B,Pass
19983,M,Pass
19983,R,Pass
19983,G,Pass
19983,B,Fail
];

 

The P() function and asterisck creates an intersection of the results

=Count({<student=P({<class={18532},status={'Pass'}>}student)*P({<class={19984},status={'Pass'}>}student)*P({<class={19983},status={'Pass'}>}student)>}Distinct student)