Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression - Counting Conditionally

Hello,

I have no experience of writing expressions in click view and could use a bit of help please.

I have data loaded with one field called admitmethod (possible values are '1' or '2'). I have a pivot table in which I want to count another field called CRN which

is a unique identifier for individuals, but I only want to count those with an admitmewthod of '2'.

How would I write the expression for this?

I have tried a few things but don't really understand the syntax. Thanks for any pointers....

1 Solution

Accepted Solutions
johnw
Champion III
Champion III

If the CRN and admitmethod are in the same table, it may be worth doing something like this in the load of that table:

if(admitmethod='2',CRN) as "CRN with Admit Method 2" // or whatever name makes sense

To simplify (and probably slightly speed up) your expression to this:

count("CRN with Admit Method 2")

View solution in original post

3 Replies
Not applicable
Author

Count({<admitmethod = {'2'}>} CRN)

johnw
Champion III
Champion III

If the CRN and admitmethod are in the same table, it may be worth doing something like this in the load of that table:

if(admitmethod='2',CRN) as "CRN with Admit Method 2" // or whatever name makes sense

To simplify (and probably slightly speed up) your expression to this:

count("CRN with Admit Method 2")

Not applicable
Author

Thanks a lot John,

That is a very useful technique you highlight and works well for my purposes.

Dave.