Hello,
I'm trying to establish which two products are frequently bought together. I have the data in the below format:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Product(s)[/TD]
[TD]Apple[/TD]
[TD]Banana[/TD]
[TD]Orange[/TD]
[TD]Pear[/TD]
[/TR]
[TR]
[TD]Apple
[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]Banana[/TD]
[TD]0[/TD]
[TD]10[/TD]
[TD]0[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]Orange[/TD]
[TD]12[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]Pear[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]6[/TD]
[TD]0[/TD]
[/TR]
</tbody>[/TABLE]
So in the above, 12 customer's bought an Orange and an Apple, 10 customers bought 2 banana's, 6 customer's bought a Pear and an Orange and 5 customer's bought a Pear and an Apple.
Ideally I'd like to rank the most frequently bought combinations and the number of times this combination was purchased. So the data will be outputted in the below format:
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Product 1[/TD]
[TD]Product 2[/TD]
[TD]Quantity[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Apple[/TD]
[TD]Orange[/TD]
[TD]12[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Banana[/TD]
[TD]Banana[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Orange[/TD]
[TD]Pear[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Apple[/TD]
[TD]Pear[/TD]
[TD]5
[/TD]
[/TR]
</tbody>[/TABLE]
Due to how the data is laid out there is double-counting of combinations, but I am hoping that these duplicates can be easily identified and removed once the data is in the required format.
Many thanks.
I'm trying to establish which two products are frequently bought together. I have the data in the below format:
[TABLE="width: 500"]
<tbody>[TR]
[TD]Product(s)[/TD]
[TD]Apple[/TD]
[TD]Banana[/TD]
[TD]Orange[/TD]
[TD]Pear[/TD]
[/TR]
[TR]
[TD]Apple
[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]Banana[/TD]
[TD]0[/TD]
[TD]10[/TD]
[TD]0[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]Orange[/TD]
[TD]12[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]Pear[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]6[/TD]
[TD]0[/TD]
[/TR]
</tbody>[/TABLE]
So in the above, 12 customer's bought an Orange and an Apple, 10 customers bought 2 banana's, 6 customer's bought a Pear and an Orange and 5 customer's bought a Pear and an Apple.
Ideally I'd like to rank the most frequently bought combinations and the number of times this combination was purchased. So the data will be outputted in the below format:
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Product 1[/TD]
[TD]Product 2[/TD]
[TD]Quantity[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Apple[/TD]
[TD]Orange[/TD]
[TD]12[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Banana[/TD]
[TD]Banana[/TD]
[TD]10[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Orange[/TD]
[TD]Pear[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Apple[/TD]
[TD]Pear[/TD]
[TD]5
[/TD]
[/TR]
</tbody>[/TABLE]
Due to how the data is laid out there is double-counting of combinations, but I am hoping that these duplicates can be easily identified and removed once the data is in the required format.
Many thanks.