Market Basket Analysis
Measure how often products appear together in a basket or in later purchases by the same customers.
Four simple ratios
These four ratios use baskets as the unit of analysis. Count each product at most once per basket.
Support
Support = (Baskets containing X & Y) ÷ (Total baskets)
Support tells you how common the pair is. A high-support pair shows up in many transactions. But support alone can be misleading—two popular items will naturally co-occur often, even with no real affinity.
Attached rate (confidence)
Attached Rate = (Baskets containing X & Y) ÷ (Baskets containing X)
Given someone bought X, what fraction also bought Y? This is the conditional probability P(Y|X). A 40% attached rate means Y also appears in four of every ten baskets containing X.
Affinity (lift)
Affinity = Attached Rate ÷ P(Y)
Affinity divides the observed attached rate by the overall rate for Y. Values above or below 1 indicate more or less co-occurrence than expected if the items were independent.
Cherry pick rate
Cherry pick rate = (Baskets containing Y but not X) ÷ (Baskets containing Y)
This is the share of baskets with Y that omit X. Even one purchase of Y without X gives a 100% rate if that is the only purchase of Y. Read it alongside the purchase count.
Worked example
Imagine 100 baskets. Product X appears in 40 baskets. Product Y appears in 30 baskets. Both X and Y appear together in 20 baskets.
| Metric | Calculation | Result |
|---|---|---|
| Support | 20 / 100 | 0.20 (20%) |
| Attached Rate | 20 / 40 | 0.50 (50%) |
| P(Y) | 30 / 100 | 0.30 (30%) |
| Affinity (lift) | 0.50 / 0.30 | 1.67× |
| Cherry Pick | (30 − 20) / 30 | 0.33 (33%) |
1 Upload transaction data
Upload a CSV with at least these columns: Transaction ID, Product, and optionally Date and Customer ID. Each row is one product in one transaction. The tool auto-detects column names. Use YYYY-MM-DD for purchase dates. For a timestamp, the date printed in the record determines its window.
The demo loads six months of synthetic retail transactions (coffee, photography, and stationery baskets with built-in associations) and pre-fills the settings. Click Run Analysis to see the results.
Preview (first 5 rows):
2 Configure analysis
Same-customer later purchases
The main tool looks at co-occurrence within the same basket. But sometimes you want a different question: among customers who bought X in one time period, what did they buy in a different time period?
This is useful for sequential cross-sell: if someone buys a camera in January, do they come back for a lens in February? For this analysis your CSV needs a Customer ID column and a Date column.
The demo data includes camera buyers who return for lenses and tripods a few months later — it pre-fills the anchor and follow-up periods below and runs the analysis for you.
1 Define the anchor period
Pick the time window where customers bought the anchor product (X). Only customers with X in this window are included.
2 Define the follow-up period
What did those same customers buy during this second window?
How to read the results
The results table gives you four numbers for every product Y paired with your anchor X. Here is what each one means and how to act on it.
Affinity (lift)
Attached rate (confidence)
Compare lift with attached rate and pair count. A large ratio can come from a rare product or a handful of purchases. A placement or bundle test can estimate whether an intervention changes sales.
Support
The share of all baskets containing both X and Y. Support acts as a frequency filter. Very low-support pairs (e.g. 0.1%) may have extreme affinity scores simply because they appeared together by accident in a tiny number of baskets. Set a minimum support threshold (we default to 1%) to filter out noise.
Cherry pick rate
Use the share of Y baskets without X to describe how often the products were purchased separately. Read it with the total number of Y baskets.
The bubble chart
When available, the bubble chart plots each product Y on two axes:
X-axis: Attached Rate (how often Y appears alongside X).
Y-axis: Affinity (Lift) — how much more than chance.
Bubble size: Support (how frequent the pair is overall).
Large bubbles in the top right indicate frequent pairs with high attached rates and high lift.
Simpson’s Paradox. Aggregate patterns can reverse when you segment by store, region, or customer type. If results seem surprising, drill down.