Multi-product customer analysis

egspen2

New Member
Joined
Apr 22, 2024
Messages
12
Office Version
  1. 365
Platform
  1. Windows
I have a list of customers including the products they bought, amount they paid for each product, and the month they bought that product. I'm trying to put together an analysis that shows (for example) "when a customer buys product 10, they buy these other, related products in the periods after". Basically trying to show a list of customers that bought product 10 and then show all other sales after that product 10 purchase over time. Attached is my current data source, just having trouble trying to figure out the right pivot / table / presentation to accomplish this.

Unable to get the xl2bb add-in to work so here is a snip of a few rows of the data:
1743688230423.png
 
Hi @egspen2 ,

Here's what i would do for start:

Classeur1
ABCDEFG
1ProductNameAmountEnd of MonthFirst boughtBought after
2Prod3Customer10-27,452024-01-22Prod1Prod3;Prod2
3Prod1Customer10749,402024-05-22Prod1Prod2
4Prod5Customer2159,962024-05-22Prod1Prod3
5Prod3Customer2129,982024-05-22Prod3Prod1;Prod2
6Prod5Customer4563,152024-05-22Prod3Prod1
7Prod3Customer1026,972024-06-22Prod3Prod2
8Prod5Customer8-19,502024-06-22Prod3Prod1
9Prod3Customer2141,982024-06-22Prod5Prod3;Prod1
10Prod1Customer3799,602024-06-22Prod5Prod4
11Prod2Customer10-1,052024-07-22
12Prod2Customer9500,102024-09-22
13Prod5Customer4-0,342024-10-22
14Prod4Customer8-0,302024-11-22
15Prod1Customer2-3049,952024-12-22
16Prod2Customer3255,002025-01-22
17Prod2Customer3495,002025-01-22
18Prod2Customer9535,002025-01-22
19Prod2Customer5320,002025-01-22
20Prod3Customer2535,002025-01-22
21Prod5Customer7395,002025-01-22
Feuil1
Cell Formulas
RangeFormula
F2:G10F2=LET(listProduct,A2:A21, listCustomer,B2:B21, listMonth,D2:D21, tbl,SORT(HSTACK(SEQUENCE(MAX(ROWS(listProduct),ROWS(listCustomer),ROWS(listMonth))),listProduct,listCustomer,listMonth),4,1), getProduct,LAMBDA(tbl,orderId,LET(orderInfo,FILTER(tbl,CHOOSECOLS(tbl,1)=orderId,""), tempTbl,DROP(tbl,MATCH(orderId,CHOOSECOLS(tbl,1),0)), TEXTJOIN(";",TRUE,UNIQUE(CHOOSECOLS(FILTER(tempTbl,(CHOOSECOLS(tempTbl,2)<>INDEX(orderInfo,1,2))*(CHOOSECOLS(tempTbl,3)=INDEX(orderInfo,1,3)),""),2))))), listProductBoughtAfter,SORT(DROP(REDUCE("",SEQUENCE(ROWS(tbl)),LAMBDA(t,r,VSTACK(t,HSTACK(INDEX(tbl,r,2),IFERROR(getProduct(tbl,r),""))))),1),1,1), FILTER(listProductBoughtAfter,CHOOSECOLS(listProductBoughtAfter,2)<>""))
Dynamic array formulas.


As you can see, it output a table with product and other item that were bought after. The function will loop all rows, find the customer order after the one of the row and remove the one with the same product and return a concatenated list of items that are different and were bought after the order.

I'm not quite sure how you want to output this but don't hesitate to reply on what you would like to see next!

Bests regards,

Vincent
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top