Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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!
Hi,
Try with this :
Count({$<Customer_ID={"=Count(distinct Product_ID)>1"}>} distinct Customer_ID )
Hope this help you.
Vikas
@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.
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;
@chris_djih good idea! Looks nice. I will try to test it! 🙂