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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikeers
Creator II
Creator II

Smart way to calculate/find customers in load script

Hi!
I'm looking for a way to cleverly count customers who bought AT LEAST x products (e.g. 2, or 5 - freely programmable) from the list during ONE TRANSACTION.

So - what do I have:
1) A list of products to be taken into account. /ProdID/
2) A table with sales. /Date, TransID, CustID, ProdID, Qty, Sales/

I know that I can group it appropriately, throw out only the sales of these products from the list, add a column with the flag '1' and count at the end. However, I'm looking for a "smarter" way. Maybe someone could suggest something?

Labels (3)
12 Replies
qlikeers
Creator II
Creator II
Author

Thanks! I'll try.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

How about:

MultiCust:
Load *
Where ProductCount >= 2
;
Load
CustID,
Count(Product) as ProductCount
Resident Data
Group By TransId, CustID
;

-Rob
http://www.easyqlik.com
http://masterssummit.com
http://qlikviewcookbook.com

qlikeers
Creator II
Creator II
Author

Thanks for Your proposal!
This probably won't give the expected result, for two reasons:
1) It is supposed to count customers who bought at least X products in one order.
2) These at least X products are supposed to apply to a precisely defined group of products.

I did it in load script, similar to @ Qrishna. I wanted it to be in LS. The example with "Window" is interesting!