Analistable

What sells best, and who spends most, across all our stores?

By the Analistable team · Updated · 3 min read

Stack each store's export with a Store column, make sure customers and products use the same keys across stores, then group and rank: SUMIFS + SORTBY or a pivot table in a spreadsheet, GROUP BY … ORDER BY … LIMIT in SQL. A COUNT(DISTINCT store) per customer shows who buys in more than one place — ana@lune.fr in the example.

Part of our guide: How to answer questions across multiple spreadsheets

The data

Orders from two stores (Web and Amazon), stacked
CustomerOrderDateAmountStore
ana@lune.frO12026-01-14120Web
ana@lune.frO22026-03-0280Web
ana@lune.frO32026-08-2195Amazon
ben@hart.co.ukO42026-02-1060Amazon
eva@nordic.dkO52026-04-05200Web
eva@nordic.dkO62026-09-12150Web
kim@kiln.ioO72026-06-3045Amazon

Top customers

SELECT customer, SUM(amount) AS spend
FROM orders
GROUP BY customer
ORDER BY spend DESC
LIMIT 3;
Result
customerspend
eva@nordic.dk350
ana@lune.fr295
ben@hart.co.uk60
=TAKE(SORT(GROUPBY(Orders[Customer], Orders[Amount], SUM, 0, 0), 2, -1), 3)

GROUPBY is available in recent Microsoft 365 builds; elsewhere use a pivot table sorted by Sum of Amount.

Customers in more than one store

SELECT customer
FROM orders
GROUP BY customer
HAVING COUNT(DISTINCT store) = 2;
Result
customer
ana@lune.fr

Multi-store customers are often the most loyal; treating them as two customers understates their value.

Making the stores comparable

  • Product keys: map each store's product IDs (ASIN, Shopify variant ID) to your own SKU before ranking products.
  • Customer keys: marketplaces may hide buyer emails; rank customers only within stores where you have them.
  • Currency and tax: convert to one currency and compare net of VAT.
  • Returns: rank on net sales — see products with high return rates.

Ask it in Analistable: “Top 10 products by revenue across all stores this quarter, and which customers bought in more than one store.”

Top products

SELECT sku, SUM(amount) AS revenue
FROM orders_with_sku
GROUP BY sku
ORDER BY revenue DESC
LIMIT 10;

The same query on the product column ranks products; run it per store as well (GROUP BY store, sku) to see whether a product sells everywhere or only in one channel.

How concentrated is revenue?

Share of total revenue (750)
CustomerSpendShareCumulative
eva@nordic.dk35046.7%46.7%
ana@lune.fr29539.3%86.0%
ben@hart.co.uk608.0%94.0%
kim@kiln.io456.0%100%

Two customers bring 86% of revenue. A cumulative share column shows concentration risk better than a ranked list. By store, the web shop took 550 (73.3%) and Amazon 200 (26.7%).

SELECT customer, SUM(amount) AS spend,
       ROUND(100.0 * SUM(amount) / SUM(SUM(amount)) OVER (), 1) AS share_pct
FROM orders
GROUP BY customer
ORDER BY spend DESC;

Older Excel and Google Sheets

  • Excel 2019 / 2016: insert a pivot table from the stacked table, Customer (or SKU) in Rows, Sum of Amount in Values, then sort descending and use Value Filters › Top 10 to keep the top N.
  • Google Sheets: =QUERY(Orders!A2:E, "select A, sum(D) where A is not null group by A order by sum(D) desc limit 3", 0) with customer in A and amount in D.
  • Ties: RANK.EQ gives equal values the same rank; decide whether a “top 10” can include an eleventh tied product.

Troubleshooting

Common problems
SymptomCauseFix
Same product listed twiceDifferent IDs per storeJoin through a SKU mapping table
Marketplace customers missingBuyer emails hidden or anonymisedRank customers per store, products across all
Totals higher than financeGross incl. VAT and shipping in one storeUse the same net amount column everywhere

Run the ranking for the same period each month and keep the previous month's list next to it — products moving into or out of the top 10 are often more useful than the list itself. To build the stacked table in the first place, see combining data from multiple sources.

Frequently asked questions

How do I combine sales from several stores?
Stack each store's export with a Store column, using the same product and customer keys, then group and rank.
How do I find customers who buy in more than one store?
Group orders by customer and keep those with COUNT(DISTINCT store) greater than 1.
What if each store uses different product IDs?
Create a mapping table from each store's ID to your SKU and join through it before ranking.
How do I see the share of revenue from top customers?
Divide each customer's spend by total revenue and add a running total; the cumulative share shows concentration.
Should I rank on gross or net sales?
Net of refunds and returns where you can, so heavily returned products don't top the list.
Can I rank products per store as well?
Yes: group by store and product, then rank within each store with RANK() OVER (PARTITION BY store ...).

Related guides