Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikeers
Creator II
Creator II

Counting customers who bought bundles

Hi!

I come to you with a request to suggest an idea for solving the problem.

I have a sales table as in the attachment. It has more data, of course, but this is what it looks like.

 

How (at the load editor level) to mark customers who have bought on ONE INVOICE:

- a selected set of products (e.g. 'HZJFNNZH' and 'QHUXWGTW'),

- minimum x pieces (where x is also fixed), eg. 'HZJFNNZH'> = 5 and 'QHUXWGTW'> = 10.

 

Of course, there may also be other products on the invoice.

 

Thanks for any suggestions!

 

4 Replies
vikasmahajan

Hi,

Try with this :

Count({$<Customer_ID={"=Count(distinct Product_ID)>1"}>} distinct Customer_ID )

vikasmahajan_0-1642771498066.png

Hope this help you.

Vikas

 

Hope this resolve your issue.
If the issue is solved please mark the answer with Accept as Solution & like it.
If you want to go quickly, go alone. If you want to go far, go together.
qlikeers
Creator II
Creator II
Author

@vikasmahajan , thanks for Your answer. But it seems to me that we did not understand each other. 

But it seems to me that we did not understand each other.
My problem is rather more complicated.

I need to mark those customers who meet these two conditions together on one invoice. The list of products and the minimum quantity is defined as a parameter.

And one more important thing - I have to do this (as I wrote above) from the load script.

chris_djih
Creator III
Creator III

Hi, i may have thought it over and it looks not quite smart, but its my first straight forward attempt and it results in the desired outcome when i grapsed everything correctly:

bundle1Invoice:
Load
Invoice_ID,
Qty 	as Qty_HZJFNNZH
Resident Invoice
where Match(Product_ID,'HZJFNNZH');

left join(bundle1Invoice)
Load
Invoice_ID,
Qty 	as Qty_QHUXWGTW
Resident Invoice
where Match(Product_ID,'QHUXWGTW');

ConditionedInvoice_MAP:
mapping Load 
	Invoice_ID,
	1
Resident bundle1Invoice
where Qty_HZJFNNZH >= 5
  and Qty_QHUXWGTW >= 10 // if u use "or"/"and "depends on if you want both products in one invoice or either
;

//comment out to see the interim results
drop table bundle1Invoice; 

Customer_Flags:
Load distinct
	Customer_ID,
    ApplyMap('ConditionedInvoice_MAP',Invoice_ID,0)	as bundle1_flag
resident Invoice;

 

If you found help, mark the correct answer and give some likes to ALL contributors, that tried to help.
qlikeers
Creator II
Creator II
Author

@chris_djih good idea! Looks nice. I will try to test it! 🙂