Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
shirleyc40
Creator
Creator

Counting distinct values conditionally

Hi. 

I have data that looks like this: Say for June

EventNameCustomerID
StockRequest29835
StockRequest29835
StockRequest29402
Checkout29835
Checkout29402

 

if I just do count(distinct CustomerID) it returns 4. I want to count the number of distinct stock requests. So customer 29835 had two stock requests, but I just want to count it as 1.  So it should return 2 for june.

1 Solution

Accepted Solutions
Taoufiq_Zarra

@shirleyc40 

I can't find the same values

for distinct customer :

=count(distinct CustomerID) 

it return 2

and for number of distinct stock requests

=count({<EventName={'StockRequest'}>} distinct CustomerID) 

 

return also 2

 

output :

Capture.PNG

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

1 Reply
Taoufiq_Zarra

@shirleyc40 

I can't find the same values

for distinct customer :

=count(distinct CustomerID) 

it return 2

and for number of distinct stock requests

=count({<EventName={'StockRequest'}>} distinct CustomerID) 

 

return also 2

 

output :

Capture.PNG

 

Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉