(+351) 21 24 10006  ·  info@bconcepts.pt
Carnaxide, Lisbon
Market basket analysis: what sells together
Marketing

Market basket analysis: what sells together

João Barros 05/07/2026 7 min

There is a famous story in the data world: a supermarket supposedly discovered that, late in the afternoon, people who bought nappies also bought beer. The story is probably exaggerated, but it stuck because it illustrates a powerful idea — inside purchase receipts hide patterns that nobody planned and that can be worth money.

Market basket analysis is the technique that looks for those patterns. Instead of looking at products one by one, it looks at what appears together in the same transaction. The question it answers is easy to state and hard to answer by hand: which products tend to be bought together, and how strongly?

This article explains the technique without intimidating maths. We will look at the three numbers that matter, a step-by-step example, what to do with the results, and the mistakes that lead many people to draw wrong conclusions from patterns that, in the end, mean nothing.

What market basket analysis is

In essence, it is a way of finding association rules of the type "people who buy A tend to buy B". Each purchase is a basket — the set of items that went through the checkout at the same time. By analysing thousands or millions of these baskets, you look for combinations that appear frequently and, above all, that appear together more than would be expected by chance.

Market basket analysis: what sells together

The goal is not just curiosity. Knowing what sells together informs concrete decisions: which products to suggest on an item's page, which bundles to create, where to place products in the store and which promotions make sense — and which destroy margin without winning sales.

The three numbers that matter: support, confidence and lift

The whole technique rests on three measures. Understanding them is most of the work.

  • Support: how often the combination appears. It is the proportion of baskets that contain, for example, A and B at the same time. High support means the pattern is common.
  • Confidence: given that someone bought A, how likely they also buy B. It is the strength of the rule "A leads to B", but on its own it deceives.
  • Lift: how much more likely it is to buy B when you buy A, compared with buying B in general. A lift of 1 means there is no relationship; above 1, there is attraction; below 1, the products even repel each other.

Lift is the number that avoids the biggest trap. A very popular product — say, plastic bags — appears with almost everything and generates high confidence in many rules. But that is not a useful pattern: it is just popularity. Lift corrects this by comparing with the product's base frequency.

A step-by-step example

Imagine a store with 1000 transactions. Coffee appears in 200 (20% support). Sugar appears in 150 (15%). Coffee and sugar together appear in 120 transactions (12% support).

The confidence of the rule "coffee leads to sugar" is 120 divided by 200, that is, 60%: of those who buy coffee, 60% also take sugar. It looks strong. Lift confirms it: 60% confidence divided by sugar's 15% base frequency gives a lift of 4. Buying coffee makes buying sugar four times more likely than usual. This is a real, actionable pattern.

Compare it with plastic bags, present in 700 transactions (70%). If "coffee leads to bags" has 65% confidence, it looks high — but the lift is 65% divided by 70%, less than 1. There is no association; bags appear with coffee simply because they appear with almost everything.

From pattern to action: cross-sell, bundles and layout

Finding rules is only half the work; the other half is acting without ruining what already works. Some typical applications:

  • Recommendations: suggest B on the page or at the checkout of A, using high lift as the selection criterion.
  • Bundles and promotions: putting together products already bought together can raise the average order value — but be careful not to discount what people would buy anyway.
  • Store and site layout: bring associated products closer (or sometimes further apart) to influence the shopping journey.
  • Stock management: anticipate that a stockout of one product may drag down its partner's sales.

Association rules beyond retail

Although it was born in retail, the same logic applies in many sectors. In banking, it helps to understand which financial products are taken out together. In healthcare, it finds combinations of diagnoses or treatments that occur together. On digital platforms, it reveals which features are used by the same people. In any context where baskets of items exist, the technique has a place.

Cautions: correlation is not causation

The biggest risk is reading causation where there is only coincidence. That A and B appear together does not mean A causes the purchase of B; both may be pulled by a third reason — a promotion, a time of year, the profile of whoever visits the store at that hour.

Other cautions: seasonality distorts patterns (what is true at Christmas is not in July); obvious rules — bread and butter — confirm the technique but bring no new value; and support that is too low produces rules that look strong but rest on very few transactions, making them unreliable. It is always wise to require a minimum support and to validate rules with people who know the business.

Tools and how to start

You do not need to buy expensive software to start. With SQL, you can calculate support, confidence and lift from a transactions table with a few joins and aggregations. In Python, dedicated libraries implement algorithms such as Apriori and FP-Growth, which find frequent combinations efficiently. And tools such as Power BI let you visualise and explore the rules found in a way that is accessible to the business.

The pragmatic path is to start simple: pick a product category, calculate the rules with reasonable support and lift, and test one or two concrete actions before generalising. Measuring the effect is essential — a rule is only worth it if, by acting on it, something improves.

Mini case: a food retail company

A mid-sized food retail chain wanted to increase the average value per purchase without cutting prices. Instead of general promotions, it analysed six months of transactions looking for associations with high lift within complementary categories.

It discovered that people who bought a certain type of fresh pasta often bought a specific sauce, with a lift of 3.2 — but only 18% of those who took the pasta took the sauce. The team placed the two products side by side and created a suggestion on the site. After two months, the joint purchase rate rose to 27% and the average basket value on transactions with pasta grew by around 6%, with no discounts. The gain did not come from a big campaign, but from spotting a pattern that already existed and removing the friction to follow it.

In practice

Market basket analysis is one of the techniques with the best effort-to-return ratio in retail analytics. It needs data that most companies already have — the transaction history — and returns patterns that translate into concrete actions. The key is to look at lift and not just confidence, to require enough support and to validate the rules with business knowledge.

Done carefully, it stops being a statistical curiosity and becomes a decision tool: what to offer, what to combine and where to place each product. The patterns are already in your receipts; you just have to look at them.

← Back to insights
Let's talk?

Ready to transform your data?

Book a free 30-minute meeting and find out how we can help your team make better decisions.

Book a Free Meeting
bConcepts