1. Courses
  2. Data
  3. Data Analysis with Excel, Python & AI
  4. Stop 1

35 minBeginner

Asking a question data can answer

Most analysis that disappoints started with a vague question. This lesson takes a real message, "East city sales are down. Why?", and turns it into a decision, a precise question, a metric with an exact definition, a fair comparison and a dataset, so the work that follows answers what was asked.

By the end you can

  • Turn a vague request into the decision it feeds and a question someone else could answer
  • Define a metric exactly: numerator, denominator, period, grain and filters
  • Break sales into transactions × average basket, and slice it by store, category, channel and time
  • Choose a like-for-like comparison and write your hypotheses before you touch the data
  • Write a one-page analysis plan and the SQL that splits two periods into their drivers

The everyday picture

You walk into a clinic and say, "I feel unwell." A good doctor does not order every test in the building. She asks questions first. Where does it hurt? Since when? Worse than usual, compared with what?

Then she measures something with a fixed method. Your temperature is taken the same way every time, in the same units, so today's number can be compared with a normal one. Before she orders a blood test, she already has a short list of likely causes, and she picks each test to rule one of them in or out. All of it serves a decision: rest at home, a prescription, or a referral to a specialist.

Data work runs the same way. "Sales are down" is "I feel unwell". In the first hour your job is to find out where it hurts, measure it the same way twice, list the likely causes and choose the tests. The analysis comes after that.

From a vague ask to a decision and a question

At 9:05 on Monday 19 October 2026, Mangrove Market's head of stores sends the data team a message: "East city sales are down. Why?" You are the new analyst working with Tomás, Mangrove's data analyst, and it lands on your desk. This message runs through the whole course. By the last lesson you will answer it on one page.

It is tempting to open the sales export and start making charts. Wait an hour. The message hides at least four questions. Down compared with what? Down by how much? Which sales: the tills in the stores, the app, or both? And what will the head of stores do with the answer?

Start with the last one, because it sets how precise and how fast you need to be. Ask, "What will you decide with this?" Typical answers: send the regional team into some stores this week, change a price or a promotion, raise a problem with the , or do nothing because the dip is normal. Each decision needs a different cut of the data. If the head of stores will act store by store, a city total is useless and you need the answer by store.

Then write the question so that someone else could answer it without asking you anything. A good question names five things: the metric, the place, the period, the comparison and the cut (what you will split it by).

Output
Vague:   Why are East city sales down?

Precise: In the 4 weeks to Sunday 18 October 2026, how much did till sales
         in East city's 54 stores fall against a fair comparison period,
         and which stores, categories and hours of the day account for
         most of the fall?

The precise version can be answered with a table. The vague one invites a debate. Notice that it does not ask "why" directly. Data rarely tells you why on its own. It tells you where and when, and "where and when" points you to the cause, which you then confirm by talking to the people in those stores.

1. The ask East sales down. Why? what will change? 2. The decision Act in which stores? make it exact 3. The question What fell, where, when? define it 4. The metric Weekly till sales find the rows 5. The data sale + site, 8 weeks
Each step narrows the work. The ask becomes a decision, the decision tells you which question matters, the question names a metric, and the metric tells you exactly which rows to pull.

Quick check

The head of stores' message arrives. What is the most useful first reply?

Define the metric exactly

A is a number calculated from a written definition. "Sales" sounds obvious until two people calculate it. One includes app orders and the other does not. One counts by the date of the sale and the other by the date finance posted it. Both are right by their own rules, and the head of stores gets two numbers. Write the definition down before you calculate anything. It has five parts.

  • Numerator: what you add up. Here, the amount the customer paid at the till, after discounts. Say whether tax is in and whether returns are subtracted.
  • Denominator: what you divide by, if the metric is a ratio. is sales ÷ transactions. A total such as weekly sales has no denominator, but "sales per store" divides by the number of stores open.
  • Period: the first and last moment, and the time zone. Use whole weeks, Monday to Sunday, so every weekday appears the same number of times in each period. A 4-week period has exactly four Mondays and four Saturdays.
  • : what one row of your result stands for, such as one row per store per week. Pull the finest grain the decision might need. You can add days up into weeks later, but you can never split a weekly total back into days or hours.
  • Filters: which rows are in and which are out. East city only; stores only, not DCs; till sales only, because app orders are a separate metric with their own story.

Here is the definition card Tomás and you write for the East city question. Keep it next to every number you report.

Markdown
## Metric: weekly till sales, East city
- Numerator:   sum of sale.total_cents (paid at the till, after discounts,
               tax included, returns not subtracted)
- Denominator: none for the total; average basket = sales / transactions
- Period:      Monday 00:00 to Sunday 23:59, store local time, whole weeks
- Grain:       pull one row per sale; report one row per store per week
- Filters:     site.city = 'East' and site.kind = 'store'; app orders excluded
- Source:      sale joined to site
- Owner:       Tomás

Finance has its own net sales number, with returns and tax taken off, and that is fine. Two definitions can live side by side as long as each report says which one it uses. Agreeing on one definition across a whole company is the subject of Metrics everyone agrees on in the dashboards course.

One more detail matters in SQL. Write the period as a half-open range: from the first day, up to but not including the day after the last day. sold_at >= '2026-09-21' AND sold_at < '2026-10-19' keeps a sale at 21:45 on Sunday 18 October. sold_at <= '2026-10-18' silently drops it, because '2026-10-18' means midnight at the start of that Sunday.

Quick check

The head of stores may want to know which hours of the day lost sales. Which grain should you pull?

Break the number into drivers

A total going down tells you very little. Break it into the pieces that multiply together to make it. A does this on paper. For store sales the first split is the most useful one in retail:

Output
sales = transactions × average basket

A typical Mangrove store:
  about 1,250 transactions a day × 7 days = about 8,750 a week
  8,750 × about $11 average basket       = about $95,000 a week

East city: 54 such stores                 = about $5.1M a week

Each branch splits again. Transactions are shoppers × visits per shopper. The basket is items per basket × average item price. The two branches point at different causes. Fewer transactions means fewer people came in: a new competitor, a closed road, bad weather, or empty shelves that sent regulars elsewhere. A smaller basket means people came but bought less: gaps on the shelf for things they wanted, a promotion that ended, or a move to cheaper brands.

Store sales about $95,000 a wk Transactions about 8,750 a week × Average basket about $11 Shoppers × Visits Items × Item price Slice every box by store, category, channel, day, hour
The driver tree for store sales. Sales is transactions times basket; each of those splits again. Slicing any box by store, category, channel or time shows where a change sits.

Changes in the drivers multiply too. Suppose a store's transactions fall 4% and its basket falls 2%. Its sales are now 0.96 × 0.98 = 0.941 of what they were, a fall of 5.9%. For small changes the percentages roughly add up, which makes a quick mental check easy: a 6% fall in sales with flat transactions must be almost all basket.

Then slice. Split each box by store (all 54), category (fresh produce, bakery, dairy, drinks, household and so on), channel (till or app) and time (week, weekday, hour). A fall that sits in a few slices points at something local. A fall spread evenly across every store and category points at something city-wide, such as the calendar, the weather or the economy.

Choose slices that do not overlap and together cover everything, so that the pieces add back up to the total. Consultants call this . If your 54 store rows add up to more than the city total, something is counted twice.

Quick check

A store's sales fell 10% in a month. Its number of transactions did not change. Where does the driver tree tell you to look first?

Compare like for like, and write hypotheses first

A change only means something against a fair comparison. Tomás pulls the headline in five minutes: East city's store sales averaged about $5.13M a week in the 4 weeks to Sunday 18 October, against about $5.46M a week in the 4 weeks before. That is a fall of about $330,000 a week, or about 6%. Before anyone acts on the 6%, check whether the two periods are comparable. Two things usually make them unfair.

The calendar. Festival weeks, month-end salary days, public holidays, school terms and the weather season all move grocery sales. Many festivals (Eid, Diwali, Lunar New Year) follow a lunar calendar and fall in different weeks each year, so look at the actual dates in both periods. The usual fix is to compare with the same weeks last year, shifted by 52 weeks (364 days), so that a Monday is compared with a Monday.

The stores. If a store opened, closed or shut for a refit during either period, the total moves for reasons that have nothing to do with shoppers. A comparison keeps only the stores that traded for the whole of both periods. Report new and closed stores on their own line.

Add a control: the other five cities over the same weeks. If every city fell, look for something they share. If only East city fell, look for something local to it.

Now, before you open the data, write your : a short list of possible causes, each with the evidence you would expect if it were true and the data that would show it. This matters more than it sounds. With 54 stores, 20 categories and 28 days, some number will always look odd, and an analyst without a list builds a story around whatever odd number appears first. A list turns the analysis into a set of tests, and it shows the head of stores that you considered more than one cause. You will run these tests later in this course, in Cleaning data in a spreadsheet and Pivot tables and summaries.

Quick check

A new East city store opened on 1 October. How should it be treated in the like-for-like comparison?

Do it

Write a one-page analysis plan for the East city question, then take a first look at the drivers in a spreadsheet.

  1. Write down the ask and the decision

    Copy the request word for word, with who asked and when. Under it, write the decision it feeds and the deadline. If you do not know them, ask before you start.

  2. Write the precise question

    Name the metric, the place, the period, the comparison and the cut. Read it to someone else: could they answer it without asking you anything?

  3. Define the metric and the comparison

    Fill in the five parts of the definition. Choose the comparison: same weeks last year, same stores, plus the other cities as a control.

  4. List hypotheses, data and checks

    Write five to eight possible causes with the test for each. List the tables or exports you need and the checks you will run on them before you trust a number.

    Markdown
    # Analysis plan: East city store sales
    Asked by:  head of stores, Monday 19 October 2026, 9:05
    Ask:       "East city sales are down. Why?"
    Decision:  send the regional team into specific stores next week, or not
    Deadline:  Thursday 22 October
    
    Question:  In the 4 weeks to Sun 18 Oct 2026, how much did till sales in
               East city's stores fall against the same weeks last year
               (like-for-like), and which stores, categories and hours
               account for most of the fall?
    Metric:    weekly till sales (definition card attached)
    Drivers:   transactions x average basket
    Compare:   same 4 weeks last year, like-for-like stores;
               other five cities as a control
    
    Hypotheses (test for each):
    1. Calendar: festival week in the earlier window (same weeks last year)
    2. Store changes (stores with under 28 trading days)
    3. Missing till data (rows per store per day)
    4. Fewer shoppers in some stores (transactions by store)
    5. Availability (sales by category and hour; out-of-stocks)
    6. Prices and promotions (basket and item price by category)
    7. Shift to the app (East city app orders)
    
    Data:      sale, sale_line, article, site; out-of-stock report
    Checks:    row counts per store per day; total within 1% of the
               finance weekly report; slices add back to the total
    Output:    one page with two charts, answer first
  5. Take a first look at the drivers in a spreadsheet

    With a store-level export (columns store_id, store_name, date, sales, transactions), SUMIFS adds up the rows that match conditions. It works the same in Excel and Google Sheets. Put the period's first day in H1 and the day after its last day in H2, then:

    Output
    Sales:        =SUMIFS(D:D, C:C, ">="&H1, C:C, "<"&H2)
    Transactions: =SUMIFS(E:E, C:C, ">="&H1, C:C, "<"&H2)
    Basket:       =sales cell / transactions cell
    
    Column C is date, D is sales, E is transactions.
    ">="&H1 means "on or after the date in H1";
    "<"&H2 means "before the date in H2" (the half-open range).

    Use a store-level export for transactions. In an export with one row per store, day and category, a basket with bread and milk appears in two category rows, so adding up transactions across categories counts it twice. Pivot tables, which do this for every store at once, come in Pivot tables and summaries.

Bring it to your team

Ask these before anyone starts an analysis, and again when the first number comes back.

  • What decision will this answer feed, who makes it, and by when?
  • Compared with what? Are both periods whole weeks with the same calendar events?
  • Which sales: till, app or both; gross or net; by sale date or posting date?
  • Are these the same stores in both periods?
  • Is the change in transactions, in the basket, or both?
  • What were our hypotheses before we looked, and which ones have we ruled out?

Red flags

  • A percentage change with no comparison period named.
  • A period that compares a festival month with a normal one.
  • "Sales" with no definition card, or two reports with different numbers and no explanation.
  • A cause announced after looking at one chart, with no other hypotheses considered.
  • An average basket for the city computed as an average of store averages.

Practice

Split two periods into transactions and basket

The table site(id, name, city, kind) lists stores and DCs. The table sale(id, site_id, sold_at, total_cents) has one row per checkout transaction, with sold_at in store local time and the amount in cents. Compare East city stores in two periods: before is Monday 24 August to Sunday 20 September 2026, and after is Monday 21 September to Sunday 18 October 2026, both days included. Return one row per period with the columns period, transactions (number of sales), sales_cents and avg_basket_cents (sales ÷ transactions, rounded to 1 decimal). Keep only East city stores, and use a half-open date range so a late Sunday sale is not lost.

SQL exerciseRuns in a real PostgreSQL inside your browser
-- East city store sales: before vs after, split into drivers.
-- The CASE puts each sale in a period. Still to do:
-- 1. JOIN site so you can keep only East city stores
--    (site.city = 'East' AND site.kind = 'store').
-- 2. Keep only the 8 weeks: sold_at from '2026-08-24'
--    up to, but not including, '2026-10-19'.
-- 3. Add avg_basket_cents: sales_cents / transactions, rounded to 1 decimal.
--    Tip: round(sum(total_cents)::numeric / count(*), 1)
SELECT CASE WHEN sold_at < '2026-09-21' THEN 'before' ELSE 'after' END AS period,
       count(*)         AS transactions,
       sum(total_cents) AS sales_cents
FROM sale
GROUP BY 1;
Ctrl + Enter runs
Show a solution
SQL
SELECT CASE WHEN s.sold_at < '2026-09-21' THEN 'before' ELSE 'after' END AS period,
       count(*)           AS transactions,         -- one row = one checkout
       sum(s.total_cents) AS sales_cents,
       round(sum(s.total_cents)::numeric / count(*), 1) AS avg_basket_cents  -- ratio of sums
FROM sale s
JOIN site st ON st.id = s.site_id                  -- to know each sale's city and kind
WHERE st.city = 'East' AND st.kind = 'store'       -- the filters from the definition
  AND s.sold_at >= '2026-08-24'                  -- half-open range: first day included
  AND s.sold_at <  '2026-10-19'                  -- keeps Sunday 21:45, drops Monday 19th
GROUP BY 1;

Sales fell from 8,800 to 7,350 cents (about 16.5%). Transactions fell from 8 to 7 (12.5%) and the basket from 1,100 to 1,050 cents (about 4.5%): 0.875 × 0.955 = 0.835, which matches. The starter also counted the North store, the sale on Sunday 23 August and the sale on Monday 19 October. Writing sold_at <= '2026-10-18' would have lost the 21:45 sale on the last Sunday.

Pass the exercise to finish this task.

Turn a vague ask into a plan

Imran, the product manager for the Partner app, forwards a message from the head of wholesale: "Partner shops are ordering less. Can you look into it?" Mangrove has about 1,800 partner shops and about 4,000 partner orders a week. Write the top of an analysis plan: the decision you think it feeds (and the question you would ask to confirm it), a precise question, a metric definition with all five parts, a comparison, and at least five hypotheses with a test for each.

  • You name a decision and the question you would send back to confirm it
  • The question names a metric, a place, a period, a comparison and a cut
  • The metric has a numerator, a denominator if it is a ratio, a period, a grain and filters
  • The comparison handles the calendar and keeps the same shops in both periods
  • At least five hypotheses, each with a test that could rule it out, including one about the data itself
Show a model answer

Decision: probably whether to send sales reps to specific shops or change wholesale prices. I would ask: "Will you act on particular shops or areas, or on pricing for everyone?"

Question: In the 4 weeks to Sunday 18 October 2026, how did weekly partner order value change against the same weeks last year, for shops active in both periods, and which areas, shop sizes and categories account for most of the change?

Metric: weekly partner order value = sum of order totals in cents for partner orders placed Monday to Sunday (numerator; app and phone orders both included, cancelled orders excluded), grain one row per shop per week, filters: shops that ordered at least once in both periods. Also orders per shop and average order value (order value ÷ orders) as drivers.

Comparison: same 4 weeks last year aligned by weekday; festival dates checked in both years.

Hypotheses: (1) calendar or festival timing: compare with last year; (2) fewer shops ordering (churn): count active shops; (3) same shops, smaller orders: average order value by shop; (4) orders moved from phone to app and some are missing from the data: compare both channels and check row counts; (5) a price change made some lines less attractive: order value by category before and after; (6) delivery problems made shops order elsewhere: late or short deliveries by area.

Check yourself

South city's app orders in the first week of November are 12% higher than in the last week of October. The app team credits a new home screen launched on 1 November. Which comparison would you ask for first?

A store's weekly sales fell from about $95,000 to about $90,250, about 5%. Transactions fell from 8,750 to about 8,310, also about 5%. The average basket stayed at about $10.86. Which hypothesis should you test first?

Two analysts report East city sales for the same week from the same database: $5.13M and $4.71M. Neither found a bug in their own query. What should you do first?

Flashcards

Open my review

Key takeaways

  • Start from the decision the answer will feed, then write a question that names the metric, place, period, comparison and cut.
  • Define every metric in five parts (numerator, denominator, period, grain, filters) and keep the definition next to the number.
  • Break sales into transactions × average basket and slice by store, category, channel and time; the slices must add back to the total.
  • Compare like for like: same stores, whole weeks, the same weeks last year, and other cities as a control.
  • Write hypotheses with a test for each before you query anything, and put it all in a one-page analysis plan with a deadline.

Sources and further reading

Episode transcriptSales are down. Down compared with what? · about 12 minutes · tap any line to play from there
  1. NadiaImran, it's Monday morning, five past nine. The head of stores sends the data team one line. East city sales are down. Why?
  2. ImranI know that kind of message. My instinct is to open the sales export and start making charts.
  3. NadiaMost people's instinct. And it's the reason a lot of analysis disappoints. The question was vague, so the answer is vague too.
  4. ImranSo what do you do instead?
  5. NadiaYou spend the first hour on the question. That's this whole episode. And this message runs through the entire course. By the last lesson, you'll answer it on one page.
  6. NadiaHere's the everyday picture. You walk into a clinic and say, I feel unwell. A good doctor doesn't order every test in the building.
  7. ImranShe asks questions. Where does it hurt, since when.
  8. NadiaRight. Worse than usual, compared with what? Then she measures something the same way every time, like your temperature, so today's number means something next to a normal one.
  9. ImranAnd before the blood test, she already has a few likely causes in mind.
  10. NadiaExactly. Each test is picked to rule a cause in or out. And all of it serves a decision. Rest at home, a prescription, or a specialist.
  11. ImranSo sales are down is the data version of I feel unwell.
  12. NadiaThat's it. Your first job is to find where it hurts, measure it the same way twice, list the causes and pick the tests.
  13. ImranLet's go back to the message, then. What's hiding in it?
  14. NadiaAt least four questions. Down compared with what? Down by how much? Which sales, the tills in the stores, the app, or both? And what will the head of stores do with the answer?
  15. ImranI'd have started with how much.
  16. NadiaStart with the last one, the decision. It tells you how precise and how fast you need to be. If she's going to send the regional team into particular stores, a city total is useless. You need the answer store by store.
  17. ImranSo the first reply to her is a question back.
  18. NadiaTwo questions. Down compared with which period? And will you act in specific stores, or on something city-wide? Tomás, our data analyst, sends exactly that within ten minutes.
  19. ImranAnd what does she say?
  20. NadiaIf it's a few stores, she'll send the regional team in next week, and she needs something by Thursday. So now you know the cut, by store, and the deadline.
  21. NadiaIf you can see your screen, the first diagram is a stack of five boxes, each narrower than the one above. If not, picture a funnel. The ask at the top, then the decision, then the question, then the metric, and the data at the bottom.
  22. ImranEach step throws away options.
  23. NadiaYes. And the precise question names five things. The metric, the place, the period, the comparison, and the cut.
  24. ImranSay it out loud for East city.
  25. NadiaIn the four weeks to Sunday the eighteenth of October, how much did till sales in East city's fifty-four stores fall against a fair comparison? And which stores, categories and hours account for most of it?
  26. ImranThat doesn't ask why.
  27. NadiaOn purpose. Data rarely tells you why by itself. It tells you where and when. Where and when points you to the cause, and then you confirm it by talking to the people in those stores.
  28. ImranOkay. The metric. Sales is sales, surely?
  29. NadiaUntil two people calculate it. One includes app orders, one doesn't. One uses the sale date, the other the date finance posted it. Both are right by their own rules, and the head of stores gets two numbers.
  30. ImranSo you write a definition down first.
  31. NadiaIn five parts. The numerator, what you add up. The denominator, if it's a ratio. The period, with a start, an end and a time zone. The grain, which is what one row stands for. And the filters, what's in and what's out.
  32. ImranGrain is the one I'd get wrong. Give me an example.
  33. NadiaSay you pull one row per store per week. Later the head of stores asks which hours of the day lost sales. You can't answer. You can always add hours up into weeks, but you can never split a weekly total back into hours.
  34. ImranSo pull the finest grain the decision might need. Every sale with its time.
  35. NadiaYes. And one small trap with dates. If your period ends on Sunday the eighteenth, don't write sold at is on or before the eighteenth. That means midnight at the start of Sunday, so a sale at nine forty-five that evening disappears.
  36. ImranSo you write before the nineteenth instead.
  37. NadiaFrom the first day, up to but not including the day after the last day. It's called a half-open range, and the periods never overlap.
  38. ImranNow the second diagram. It looks like a family tree.
  39. NadiaIt's a driver tree. At the top, store sales. Below it, two boxes multiplied together. Transactions times average basket.
  40. ImranGive me the numbers for a typical store.
  41. NadiaAbout twelve hundred and fifty checkouts a day, so about eight thousand seven hundred and fifty a week. Times an average basket of about eleven dollars. That's roughly ninety-five thousand dollars a week. Fifty-four stores like that make East city.
  42. ImranAnd each box splits again.
  43. NadiaTransactions are shoppers times visits. The basket is items times item price. The useful part is that the two branches point at different causes.
  44. ImranLet me try. Fewer transactions means fewer people came in. A competitor opened, a road closed, bad weather.
  45. NadiaOr empty shelves that sent regulars somewhere else. And a smaller basket?
  46. ImranPeople came, but bought less. Gaps on the shelf, a promotion that ended, cheaper brands.
  47. NadiaGood. And the changes multiply. If transactions fall four percent and the basket falls two, sales are point nine six times point nine eight. About a five point nine percent fall. For small changes, the percentages roughly add up.
  48. ImranThen you slice every box. By store, category, channel, day and hour.
  49. NadiaAnd the slices must not overlap, and must add back to the total. If your fifty-four store rows add up to more than the city, you've counted something twice.
  50. ImranSo what did the first number look like for East city?
  51. NadiaTomás pulled it in five minutes. About five point one three million dollars a week in the four weeks to the eighteenth of October. About five point four six million in the four weeks before. Down about six percent, roughly three hundred and thirty thousand dollars a week.
  52. ImranThat's a lot of money. I'd be ready to act on that.
  53. NadiaThat's the trap. Tomás opened the trading calendar, and the earlier four weeks had a festival week in them. So the six percent is real money, but it's not yet a fair comparison.
  54. ImranSo what is fair?
  55. NadiaLike for like. Two things. The calendar, so you compare with the same weeks last year, shifted by fifty-two weeks, which is three hundred and sixty-four days, so a Monday meets a Monday.
  56. ImranAnd many festivals move each year. Eid, Diwali, Lunar New Year.
  57. NadiaSo you check the actual dates in both years. The second thing is the stores. Only stores that traded for the whole of both periods. A store that opened on the first of October goes on its own line.
  58. ImranAnd a control, I'd guess. The other five cities over the same weeks.
  59. NadiaYes. If every city fell, look for something they share. If only East fell, look for something local.
  60. ImranThen I open the data.
  61. NadiaNot quite. First you write your hypotheses. Possible causes, each with the evidence you'd expect and the data that would show it. Tomás and you wrote seven.
  62. ImranSeven feels like a lot for a Monday morning.
  63. NadiaIt takes ten minutes. The calendar. Store closures or refits. Missing till data. Fewer shoppers in some stores. Empty shelves or changed deliveries. Prices and promotions. And shoppers moving to the app.
  64. ImranWhy does writing them down first matter so much?
  65. NadiaBecause with fifty-four stores, twenty categories and twenty-eight days, something will always look odd. Without a list, you build a story around the first odd number you see. With a list, each query is a test.
  66. ImranAnd which one is it?
  67. NadiaThat's what the rest of the course finds out. Some of the seven will die within an hour.
  68. ImranSo the Do it section is the plan itself.
  69. NadiaA one-page analysis plan. You copy the ask word for word, then the decision and the deadline. Then the precise question, the metric card, the comparison, the hypotheses with their tests, the data you need, and the checks before you trust a number.
  70. ImranWhat checks?
  71. NadiaRows per store per day, so a missing till upload can't look like a sales drop. The total within one percent of finance's weekly report. And the slices adding back to the total.
  72. ImranAnd there's a spreadsheet step at the end.
  73. NadiaA first look at the drivers with SUMIFS, which works in Excel and Google Sheets. Total sales for the period, total transactions, and the basket is one divided by the other. One warning there. Use a store-level export for transactions.
  74. ImranWhy?
  75. NadiaIf the export has one row per store, day and category, a basket with bread and milk shows up in two rows. Add up transactions across categories and you count that shopper twice.
  76. ImranAnd the practice is the same split in SQL.
  77. NadiaTwo periods, before and after the twenty-first of September. You join the site table to keep only East city stores, use a half-open date range, and return transactions, sales and the average basket for each period.
  78. ImranHere's what I'll ask in my next review, then. What decision does this feed? Compared with what? And which sales, exactly?
  79. NadiaAdd one. Is the change in transactions, in the basket, or both? Now a quick one for you, Imran. Take a second. A store's sales fell about five percent, and transactions also fell about five percent. Where do you look?
  80. ImranThe basket didn't move, so the whole drop is fewer visits. Footfall, like a road closure or a new competitor nearby.
  81. NadiaExactly. A price change or an ended promotion would show up in the basket.
  82. ImranLet me sum up. One, start from the decision, then write a question that names the metric, place, period, comparison and cut.
  83. ImranTwo, sales is transactions times basket, and you slice it by store, category, channel and time. Three, compare like for like, then write hypotheses before you touch the data.
  84. NadiaOne nuance on the first. Keep the five-part definition next to every number you report. That's what stops two analysts from arguing over two different sales numbers.
  85. ImranNext time?
  86. NadiaWe open the export, and before we trust a single row, we clean it in a spreadsheet.
Finished reading?Mark it complete to fill in its stop on your course line.

Use it at work

Monthly sales report

Revenue, orders and average order value per month, with the change on the month before.

Open in the SQL Lab
Next stopCleaning data in a spreadsheet
Was this lesson helpful?
Questions and discussion

Loading the discussion…