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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
q11hhg
Contributor III
Contributor III

count distinct with aggr function?

Hi, I want to calculate the distinct count of the customer with a total events greater than 2

by using:

count( {<
[Event Type] = {'P'},
[Customer ID] = {"=sum([Total Events])>=2"}

>}
distinct [Customer ID] )

It does not give me the expected result. I think it needs an aggre function or summarize function that first summarizes the total events by the customer and then distinct count.

 

But I do not know how to do it, could you please help. I have my sample data attached, thanks . 

 

 

 

 

3 Replies
Saravanan_Desingh

Your code works for me. Please check your App. You might be missing something.

=count({<[Event Type] = {'P'},[Customer ID] = {"=sum([Total Events])>=2"}>}distinct [Customer ID])

commQV27.PNG

q11hhg
Contributor III
Contributor III
Author

hI @Saravanan_Desingh  Thank you , I just do not know where the error coming from, when I selected the same period, I will end up with 43 not 36

q11hhg
Contributor III
Contributor III
Author

Hi @Saravanan_Desingh  I think I know where the extra numbers are coming from , but I do not know how to fix it.

The expression {<'P'>}, does not work, if you load the attached file and do the same expression, the result will be wrong. it will take both event type. For event P the number of customers should be only 3.