Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
akmughal
Contributor II
Contributor II

Count if equal 1

Hi there,

I'm not sure how to get distinct Group ID count if there is a single entry of a client.

So, in below example I wanted to count distinct group id of all clients who have just one entry date.

Client IDEntry DateExit DateGroup ID
27/1/20208/20/2020100
37/1/20208/20/2020100
810/1/202012/20/2020101
105/1/20206/20/2020102
107/1/20208/20/2020102
117/1/20208/20/2020102

 

Result = 3

I'm trying this expression but does not work

=Count(aggr(if(count([Client ID]) = 1,[Group ID]),[Group ID]))

Could someone help how to write correct statement?

Thank you,

akmughal

 

 

 

13 Replies
Kushal_Chawda
MVP
MVP

@akmughal  try below

=count(DISTINCT aggr(if(Count([Client ID])=1,[Group ID]),[Group ID],[Client ID]))

akmughal
Contributor II
Contributor II
Author

It worked. Thank you!

Kushal_Chawda
MVP
MVP

@akmughal  Please accept solution

albertovarela
Partner - Specialist
Partner - Specialist

Great to hear @akmughal ! Please accept as solution so the thread can be closed.