The short answer
Product affinity measures how much more often two categories land in the same order than chance would predict. Divide orders containing both by all orders to get support, then divide that by the product of each category's own order share to get lift. A lift above 1 marks a real pairing worth merchandising together.
A market basket analysis example, step by step
Why it matters
Pairs customers already buy together are the cheapest cross-sell you have, because the demand already exists. Missing them leaves bundles, page recommendations and store layouts to guesswork, and keeps units per transaction below what your basket data could support.
The question to ask
Copy this into Lexi as written.
How to work it out
1. Pull orders at category level. Take every order from the past year, online and in store, and list the categories in each one.
2. Count pairs and calculate lift. For each category pair, work out support and lift, and drop pairs that appear in too few orders to trust.
3. Check who buys the pair. Compare customers who buy both categories with those who buy only one, on repeat rate and annual spend, to see which pairings build better customers.
What the answer looks like
Illustrative output on sample data
Illustrative example: how Lexi answers this for a beauty retailer. It counts how often category pairs share an order across 200,000 orders, then measures lift against chance.
- Serum in 15% of orders, SPF in 12%. Together in 9,000 orders, support 4.5%. Lift = 4.5% ÷ 1.8% = 2.5.
- Fragrance and nail polish share 1,200 orders against 1,500 expected. Lift 0.8.
What the data shows
Serum and SPF land in the same basket 2.5 times more often than chance. Fragrance and nail polish pair less often than chance.
What it means
Customers who buy serum and SPF together spend $410 a year, against $260 for serum-only buyers. The pairing is worth building on.
What to do
Feature SPF on serum product pages and send serum-only buyers an SPF follow-up.
Would you like me to build the serum-only segment and push it to Klaviyo?
Frequently asked questions
What is the difference between support, confidence and lift?
Support is the share of all orders containing both categories. Confidence is the share of orders with category A that also contain B. Lift compares the pair's support with what chance would give, which corrects for popular categories that turn up in many baskets anyway. Rank pairs by lift, then check support.
Why do bestsellers top every frequently bought together analysis?
Categories that sit in a large share of orders appear alongside almost everything, so raw pair counts favor them. A frequently bought together analysis ranked on counts alone will always lead with your bestsellers. Lift removes that bias by comparing each pair with its expected rate, which surfaces the pairings customers choose on purpose.
Should market basket analysis in retail include store orders?
Yes, wherever store transactions can be matched to orders and customers. Store baskets often differ from online ones, with more impulse and add-on items at the register. Running the analysis on online orders alone misses those pairings and gives store teams nothing to use for layout or associate prompts.