Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Class | 18532 | 19984 | 19983 |
Student | |||
Mark M. | Pass | Pass | Pass |
Richard S. | Pass | Pass | Pass |
Gary D. | Pass | Pass | Pass |
Bryan J. | Pass | Pass | Launched |
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
)
)
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)
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)