Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

Count(Distinct()) with condition

Hi!

I want to use COUNT(DISTINCT()) to calculate the number of clients that bought a certain product. I am using this formula, but the numbers are weird, it's not correct.

IF(CPRODUS='A19', COUNT(DISTINCT(CCLIENT)))

What to i do wrong?

1 Solution

Accepted Solutions
manas_bn
Contributor

Re: Count(Distinct()) with condition

Hi Laura,

I hope this is what you are looking for. Here goes -

You can use

IF(CPRODUS='A19', COUNT(DISTINCT CCLIENT)) OR

Count({$<CPRODUS={'A19'}>} distinct CCLIENT) OR // value changes based on selections

Count({1<CPRODUS={'A19'}>} distinct CCLIENT) // value remains same regardless of selections

But the correct value will still depend on which chart you are using and what dimensions...

Cheers,

Manas

3 Replies
manas_bn
Contributor

Re: Count(Distinct()) with condition

Hi Laura,

I hope this is what you are looking for. Here goes -

You can use

IF(CPRODUS='A19', COUNT(DISTINCT CCLIENT)) OR

Count({$<CPRODUS={'A19'}>} distinct CCLIENT) OR // value changes based on selections

Count({1<CPRODUS={'A19'}>} distinct CCLIENT) // value remains same regardless of selections

But the correct value will still depend on which chart you are using and what dimensions...

Cheers,

Manas

rajeshvaswani77
Valued Contributor III

Re: Count(Distinct()) with condition

Hi,

Can you try this

count(if(CPRODUS='A19',DISTINCT(CCLIENT)))

thanks,

Rajesh Vaswani

Not applicable

Re: Count(Distinct()) with condition

Thanks, guys, it works now.

Community Browser