Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

pascos88
Contributor

Count distinct in set analysis

Good morning,

I need a select distinct in the set analysis.

my formula is

count({<lgn_username ={"=count distinct (lgn_username)>2"}>} CompanyName) but the result is zero.

if I do

count({<lgn_username ={"=count (lgn_username)>2"}>} CompanyName) without the distinct, give me a number... looks that the distinct insiede doesn't work..

Any Idee or someone can see the error in the expression ?

Thanks for any helps

1 Solution

Accepted Solutions
agigliotti
Honored Contributor II

Re: Count distinct in set analysis

maybe this:

sum( aggr( if( count(distinct lgn_username ) > 2, 1, 0 ), CompanyName ) )

Hope it helps.

3 Replies
agigliotti
Honored Contributor II

Re: Count distinct in set analysis

maybe this:

sum( aggr( if( count(distinct lgn_username ) > 2, 1, 0 ), CompanyName ) )

Hope it helps.

MVP
MVP

Re: Count distinct in set analysis

the keyword DISTINCT has to be put inside the aggregation function like this:

Count( { < lgn_username = { "=Count( DISTINCT lgn_username)>2"}>} CompanyName )


pascos88
Contributor

Re: Count distinct in set analysis

for some reason  doesn't work.

The result is 0.. btw thanks for your answer