AI for retail

AI for retail lets you ask your own till and stock data which lines have stopped selling while the books still show units. Each line comes back with the store, the days and the rule that flagged it. The same data sets staffed hours against door counts and checks each delivery against its dispatch note.

Last reviewed · Virgo Analytics

One question, traced, example

3 of 8 lines hold 71 book units but have stopped selling

Example data

You asked

Which lines show stock on the books but no sales at store 07?

Checked stock against till sales7 steps

  1. Read the question

    You want lines that store 07 holds on paper but has stopped selling. I used the gifts and accessories bay and stock as at close on 15 November 2026, the last full day.

  2. Decide whether to query

    Stock and till sales change every day, so this needs the store's own data, read today.

  3. Pick the dataset

    Used tills.sales_lines, one row per line per till sale, and stock.stock_on_hand, one row per line per store per day. merch.products gives the bay. Door counts aren't needed for this.

    tills.sales_linesstock.stock_on_hand

  4. Set the rule

    A line's sales rate is the units it sold in the 56 days up to its last sale, divided by 56. If sales arrive at random at that rate, a run of ln(100) ÷ rate days with no sale has a chance of 1% or less. A line past that limit, with stock on the books, goes on the shelf-check list.

  5. Write the query

    Last sale date and rate per line, then book stock for the day, then the limit and the flag.

    WITH last_sale AS (
        SELECT
             s.sku
            ,MAX(s.sale_date) AS last_sale_date
        FROM tills.sales_lines s
        WHERE 1=1
            AND s.store_id = 'S07'
            AND s.units > 0
        GROUP BY
             s.sku
    )
    
    ,sales_rate AS (
        SELECT
             l.sku
            ,l.last_sale_date
            ,SUM(s.units) / 56.0 AS units_per_day
        FROM last_sale l
        JOIN tills.sales_lines s
            ON 1=1
            AND s.sku = l.sku
            AND s.store_id = 'S07'
            AND s.units > 0
            AND s.sale_date > l.last_sale_date - 56
            AND s.sale_date <= l.last_sale_date
        GROUP BY
             l.sku
            ,l.last_sale_date
    )
    
    SELECT
         p.description
        ,k.units AS book_stock
        ,ROUND(r.units_per_day, 3) AS units_per_day
        ,DATE '2026-11-15' - r.last_sale_date AS days_since_sale
        ,ROUND(LN(100) / r.units_per_day, 1) AS likely_gap_limit
        ,DATE '2026-11-15' - r.last_sale_date > LN(100) / r.units_per_day AS shelf_check
    FROM stock.stock_on_hand k
    JOIN sales_rate r
        ON 1=1
        AND r.sku = k.sku
    JOIN merch.products p
        ON 1=1
        AND p.sku = k.sku
    WHERE 1=1
        AND k.store_id = 'S07'
        AND k.snapshot_date = DATE '2026-11-15'
        AND k.units > 0
        AND p.category = 'Gifts and accessories'
    ORDER BY
         shelf_check DESC
        ,days_since_sale DESC
  6. Run the query

    Ran against the read-only view. Nothing was written.

    8 rows

Write the answer

Every figure below comes from those 8 rows.

  1. Canvas tote, natural Days since last sale 9, likely-gap limit (days) 3.1. 22
  2. Ceramic mug, blue Days since last sale 6, likely-gap limit (days) 1.5. 31
  3. Socks, 3-pack Days since last sale 5, likely-gap limit (days) 1.8. 18
  4. Umbrella, black Days since last sale 15, likely-gap limit (days) 36.8, book stock 6.
  5. Fig candle Days since last sale 11, likely-gap limit (days) 18.4, book stock 12.
  6. Leather gloves, brown Days since last sale 4, likely-gap limit (days) 9.2, book stock 9.
  7. Wool scarf, grey Days since last sale 1, likely-gap limit (days) 2.3, book stock 14.
  8. A5 notebook Days since last sale 0, likely-gap limit (days) 1.2, book stock 40.
Flag after ln(100) ÷ daily rate days with no sale: a chance of 1% or less.tills.sales_lines and stock.stock_on_hand, store 07, close on 15 November.

Three lines in the gifts bay look empty on the shelf while the system holds 71 units of them. The canvas tote has gone 9 days without a sale against a limit of 3.1, the blue mug 6 days against 1.5, and the 3-pack socks 5 days against 1.8. The umbrella has the longest quiet spell, 15 days, but it sells just under one a week, so its limit is 36.8 days and it isn't flagged. Check the three flagged lines on the shelf and in the stockroom before anything is reordered.

Show the numbers
The 8 rows, in query order, example data
LineBook stockUnits per dayDays since last saleLikely-gap limit (days)Shelf check
Canvas tote, natural221.50093.1Yes
Ceramic mug, blue313.00061.5Yes
Socks, 3-pack182.50051.8Yes
Umbrella, black60.1251536.8No
Fig candle120.2501118.4No
Leather gloves, brown90.50049.2No
Wool scarf, grey142.00012.3No
A5 notebook404.00001.2No

8 rowsread-onlynothing written

Example data: an invented gift and homeware chain, store 07, eight lines in one bay, stock as at close on 15 November 2026. The rule assumes sales arrive at random at a steady rate, so lines on promotion or out of season need their own rate. The AI-led demo plays three scripted questions on an invented software company, with the query open at each step as it is in steps 5 and 6 here.

What AI for retail can do with your data today

Lines that have stopped sellingEach line's own sales rate sets how long it can go quiet before the gap is unlikely, so the rule flags a fast seller within a day or two and waits weeks on a slow one. It needs till sales by line by store by day, and stock on hand by store by day.
Staffed hours against door countsThe report divides the visitors counted in at the door each hour by the staff the rota puts on the floor that hour. It lists the hours where that figure runs well above the same store's usual level for that weekday, prints the threshold, and names no member of staff. It needs the door counter's inward count by hour and the rota by hour.
Deliveries against the dispatch noteThe check matches each delivery's goods-in scans line by line to the supplier's or warehouse's dispatch note and lists any line short, over or missing before anyone updates the stock figure, so a short delivery doesn't turn into phantom stock a week later. It needs goods-in scans carrying the delivery reference, and the dispatch note as data.

Stock turn and GMROI for the same lines are on the retail KPIs page.

What does not work yet

Seeing the shelfThe alert says a line is probably wrong on the books. It can't say whether the stock is in the back, on the wrong fixture, stolen or miscounted, so a person checks and a person books the adjustment.
Slow sellers, quicklyA line that sells once a fortnight can go a month without a sale by chance, so the rule won't flag a slow line that empties today for weeks.
Recognising people on cameraWe don't build it. The ICO's Biometric data guidance: Biometric recognition says "Biometric recognition describes when you use biometric data to uniquely identify someone." Checked 20 November 2026. The regulation notes below quote the ICO's other pages on cameras.

A line with 31 units on the books and no sale in six days is a shelf problem until someone has looked.

What has to be true of your data first

  • One product code on the tills and in the merchandise system

    The check skips any till line that doesn't match stock on hand, so the unmatched codes come first as a list to fix.

  • Stock on hand by store by day, with every day kept

    A file that overwrites yesterday's figure can't date the last sale against the stock that was there.

  • Counter outages flagged hour by hour

    If the counter drops out at 2pm on a Saturday, that hour looks overstaffed. A flag on each outage hour keeps it out of the comparison.

  • Goods-in scans that carry the delivery reference

    Without it, no scan can be tied to the note it arrived on.

The AI readiness assessment runs these four checks on one store's till, stock and counter files and reports each as a pass or a named fix.

Regulation and risk notes for AI in retail

What the ICO's camera and biometric pages say, dated.

Facial recognition

The ICO's Biometric data guidance: Biometric recognition, page "Biometric recognition", says

"If you use a biometric recognition system, you are using special category biometric data."

The same guidance, in its chapter "How do we demonstrate our compliance with our data protection obligations?", says

"You must complete a DPIA before you use a biometric recognition system."

Checked 20 November 2026.

Facial recognition in shopping centres

The ICO's guidance "Video surveillance (including guidance for organisations using CCTV)", in its section "Facial Recognition Technology (FRT) and surveillance", says

"The context in which you are using such systems is a key consideration when you determine whether your use of FRT is appropriate. For example in shopping centres, you still need to be able to strongly justify that your use of FRT is lawful and necessary to achieve your outcome, and that you could not do so using less privacy intrusive methods."

Checked 20 November 2026.

Surveillance and the data protection principles

The same guidance has a page headed "How can we comply with the data protection principles when using surveillance systems?".

Checked 20 November 2026.

Review notice

Each ICO page above says

"Due to changes made by the Data (Use and Access) Act, this guidance is under review and may be subject to change."

Checked 20 November 2026.

The legislation on automated decisions and the ICO's AI guidance are listed once, on the AI for your industry page.

This is a list of the sources we read, with the date. It is not legal advice, and your own adviser decides what applies to you.

Further reading

The weekly trading view, like-for-like sales and weeks of cover are on the retail analytics page. If you also run a web shop, AI for ecommerce covers returns, product copy and marketing email. Shelf-check results also feed demand forecasting, and AI-led analytics covers the whole service, from the data layer to the traced answer.

Questions people ask

Can AI spot empty shelves from our stock data?

It can tell you where to look. When a line with stock on the books goes longer without a sale than its own rate makes likely, it goes on a shelf-check list for someone in the store.

Can we use AI on our CCTV footage?

No. We don't build recognition or work with footage. The ICO's Biometric data guidance: Biometric recognition says "Biometric recognition describes when you use biometric data to uniquely identify someone." Its page "How do we demonstrate our compliance with our data protection obligations?" says "You must complete a DPIA before you use a biometric recognition system." Checked 20 November 2026.

Does the stock alert work for slow sellers?

Yes, it just waits longer, until the gap is unlikely at that line's own rate. In the example above, the umbrella is quiet for 15 days and still isn't flagged, because its limit is 36.8 days.

Will the alert replace our stock counts?

No, a count is still the only thing that corrects the book figure. The alert points your store team at the lines most likely to be wrong between counts, so a mug that sold three a day and then nothing gets looked at this week.

Why is a line's sales rate measured up to its last sale?

Because a rate measured up to today falls every day a line sits unsold, and a falling rate pushes the limit further out. The longer the shelf stayed empty, the harder the line would be to flag. Taking the 56 days before the last sale keeps the rate the line had while it was still selling.

Which of your lines have stopped selling while the books still show stock?

A month of till and stock files for one store and one bay gives the first call a list of the lines the gap rule would have sent for a shelf check.

Book a call

Free 30 min call