Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

biggusdoggus
Contributor

Qlik Sense Server - count multiple conditions

Hi

So I have the following:

count({<PRODUCT = {'Premier','Subscription'}>}CLIENT_ID)

which does a great job of counting the client id's which have either of those products.

However, I need something that counts the client id's that have both of those products, not just one or the other.

I imagine it's quite simple, but I can't work it out (there isn't a lot of information online around Qlik Sense!

Any help would be greatly appreciated please.

1 Solution

Accepted Solutions
xufei123
Valued Contributor

Re: Qlik Sense Server - count multiple conditions

=count({<CLIENT_ID = p({<PRODUCT={'Premier'}>})*p({<PRODUCT={'Subscription'}>})>} DISTINCT CLIENT_ID)

Fei

4 Replies
devarasu07
Honored Contributor II

Re: Qlik Sense Server - count multiple conditions

Hi,

You can try like below, (i.e: Set analysis using AND Condition method)

=Count({$<PRODUCT={'Premier'}>+<PRODUCT={'Subscription'}>}CLIENT_ID)

or

=count({<PRODUCT = p({<PRODUCT = {Premier}>}) * p({<PRODUCT = {Subscription}>}) >} distinct CLIENT_ID)


Thanks,
Deva

biggusdoggus
Contributor

Re: Qlik Sense Server - count multiple conditions

Hi Deva

Thanks for the quick response.

However, the first option is still counting those clients with either one or the other products (or both - including if they have 2 "Premiers"). So it's returning 1 against clients with one of them, and 2 (or more) if they have multiple of either.

Just to clarify - I need it to count only those clients with both products.

And the second one doesn't bring back anything at all (I made sure it had the ' in the { } names).

xufei123
Valued Contributor

Re: Qlik Sense Server - count multiple conditions

=count({<CLIENT_ID = p({<PRODUCT={'Premier'}>})*p({<PRODUCT={'Subscription'}>})>} DISTINCT CLIENT_ID)

Fei

biggusdoggus
Contributor

Re: Qlik Sense Server - count multiple conditions

Thanks Fei - perfect