I often use a simple example when speaking about retail analytics: chewing gum near the payment area. It is a small detail, but it explains a much bigger idea. Retailers do not place products randomly. They think carefully about what a customer is likely to notice at a particular moment. By the time someone reaches the till, they have usually made the main decisions they came in to make. A small, low-cost product such as chewing gum is easy to add without much thought. The placement is simple, but the thinking behind it is analytical.
That same logic now runs through much more advanced parts of retail. AI demand forecasting is not only about predicting how many units of a product might sell next week. It is about understanding the conditions that make demand rise, fall, shift between locations, or appear in unexpected ways. A retailer wants to know why one store runs out while another has excess stock, why a promotion works in one area but not another, and why customers behave differently online compared with in store. At its best, AI helps retailers answer a practical question: how do we get the right product into the right place at the right time, without wasting stock, disappointing customers or tying up money in products that will not sell?
Demand forecasting starts with behaviour, not just sales
The simplest version of demand forecasting is looking at past sales and using them to estimate future sales. If a supermarket sold 500 cartons of orange juice last week, it might expect something similar next week, unless something changes. That is a useful starting point, but retail rarely stays still for long. A warm weekend can suddenly increase demand for bottled water and barbeque food. A promotion can make one week look unusually strong, while the following week looks weaker because customers bought earlier than usual. A product may appear unpopular in the sales data, when the real issue is that it was not available on the shelf.
This is where the technical work begins. A basic forecast might use a moving average, which smooths recent sales into a simple estimate. A more advanced model might look at how demand changes when the price changes, when a product is promoted, or when local conditions affect customer behaviour. The model is being asked to learn the difference between ordinary demand and demand that has been influenced by something else. That distinction matters because the retailer does not only want to know what happened. It needs to understand which parts of that pattern are likely to happen again.
A practical case study: forecasting demand for bottled water
Imagine a supermarket chain wants to forecast demand for bottled water across 300 stores. At first, this sounds simple. Bottled water is a common product, and there will be plenty of sales history. But the more closely you look, the more complicated the task becomes. A city-centre convenience store may sell bottled water to commuters during the morning and lunchtime rush. A large suburban supermarket may sell more multipacks to families doing a weekly shop. Demand may rise during warm weather, but the increase will not be identical everywhere. A promotion may increase sales, but only if the store has enough stock and enough shelf space to support it.
The pipeline would usually begin with three types of operational data. The till system records what was sold and when. The ecommerce system shows online purchases and delivery demand. The inventory system records whether stock was actually available. That final point is easy to overlook, but it is crucial. If a store sold no bottled water on Tuesday because the shelf was empty, the model should not interpret Tuesday as a day with no customer demand. It should understand that demand may have existed, but the store could not meet it. This is one of the reasons forecasting depends so heavily on data quality before any AI model is introduced.
In a typical setup, this data would be brought into a central warehouse, perhaps using a platform such as BigQuery or Snowflake. The warehouse gives the retailer one organised place where sales, stock, product and store information can be brought together. An analyst can then use SQL to create a forecasting table where each row represents a product in a particular store on a particular day. That table becomes the foundation for the model, but building it well is often the hardest part of the project.
Turning raw data into useful clues
Before a model can forecast anything useful, the analyst needs to decide what information might help explain demand. This is where feature engineering comes in. It turns raw data into variables that help the model understand the circumstances around each sale, rather than treating every transaction as if it happened in isolation.
For bottled water, yesterday’s sales may matter, but they are not enough on their own. The model may need to know whether sales have been rising across the past week, whether the item was recently discounted, whether the store ran out of stock, or whether the weather has been warmer than usual. Instead of simply feeding the model a long sales history, the analyst is helping it understand the conditions around those sales. A spike during a heatwave should be treated differently from a spike caused by a one-day promotion. Low sales during a stockout should be treated differently from low sales when shelves were full.
This is where good analysts add real value. A model can find patterns, but it does not automatically understand retail. It does not know that a product sitting in a warehouse is not the same as a product available on a shelf. It does not know that a promotion can pull demand forward from a future week. It does not know that a store near a railway station may behave differently from a store in a residential area. The analyst’s job is to help the model learn from the right signals, rather than allowing it to learn misleading patterns from messy data.

Building the model and checking whether it works
Once the forecasting table is ready, the retailer could use Python to build the model. For a manageable project, an analyst might use pandas to inspect and prepare the data, then use scikit-learn to train a model. A random forest or gradient boosting model can be useful because retail demand is rarely a straight-line problem. Demand for bottled water may not rise gently with each extra degree of temperature. It may stay fairly stable, then rise sharply once the weather becomes warm enough for people to change their plans. Models that handle non-linear patterns can be helpful in those situations.
In a larger retailer, the same process might be managed through a cloud machine learning platform, where training, testing and deployment can be repeated more easily. That matters because demand forecasting is not something you build once and forget. Customer behaviour changes, promotions change, product ranges change, and the model needs to be monitored over time. A forecast that performed well six months ago may become less reliable if prices change, a competitor opens nearby, or customers start buying differently.
Testing is just as important as building. The analyst might train the model on older data, then test it on a more recent period to see how well it would have performed. It should also be compared with a simple baseline, such as last week’s sales or the same week last year. This is a healthy discipline because a complex model is only worth using if it improves the decision. If a simple seasonal average performs almost as well, the business may not need anything more complicated for that product.
Turning the forecast into a decision
A forecast only matters if it changes what the retailer does. In the bottled water example, the model might predict higher demand in some stores over the next seven days because warmer weather is expected. That forecast could then feed into the replenishment process, where the retailer decides how much stock to send to each store. It may also affect warehouse planning and delivery scheduling. This is the point where analytics moves from being a report to being part of an operation.
The retailer may not be able to send every store exactly what the model predicts. Stock may be limited, delivery space may be limited, and smaller stores may not have room for large quantities. This is where forecasting connects with optimisation. The forecast estimates what is likely to happen, while the optimisation step helps decide the best practical response. A store with a high risk of running out may be prioritised over a store that already has enough stock. A large supermarket may receive extra multipacks, while a small convenience store may receive smaller bottles that fit its customer pattern and shelf space.
A dashboard then helps people understand what the forecast is recommending. In Power BI, Tableau or a similar tool, a retail planner might see which stores are most at risk of running out, which products have changed most since the previous forecast, and where the model is less confident. A good dashboard would not simply show a number. It would explain the reason behind the change in plain language. If warmer weather, recent sales momentum and stock availability all contributed to the forecast, the planner should be able to see that story clearly enough to act on it.
From forecasting demand to shaping demand
Retailers do not only forecast demand. They also shape it. The chewing gum example shows this clearly. The retailer is not simply predicting that customers want chewing gum. It is placing chewing gum where a quick, low-risk purchase is most likely to happen. The decision is small, but the principle is powerful: product placement can influence behaviour.
The same logic applies to products that are bought together. If customers often buy pasta and pasta sauce in the same trip, the retailer may want those products to support each other. That could mean placing them near each other, promoting them together, or making sure they are both well stocked during busy periods. A more technical team might use association rule mining to measure these relationships. The method looks at transaction data and asks whether the presence of one product in a basket makes another product more likely to appear. The business question behind it is much easier to understand: does this pattern help us make a better decision about layout, promotion or availability?
This can also feed back into forecasting. If a promotion on burgers is expected to increase demand for burger buns and sauces, the retailer needs to plan for the connected products as well. Otherwise, one successful promotion can create problems somewhere else. This is one reason retail forecasting is such a good example for data professionals. Products do not live in isolation. Customer behaviour connects them, and good forecasting needs to respect those connections.
Why forecasting is becoming more difficult
Retail forecasting is harder because customer journeys are less predictable than they used to be. A customer might discover a product on social media, compare the price online, check whether it is available locally, visit a store to see it, then order it later for delivery. The retailer sees pieces of this behaviour across different systems, but the customer experiences it as one journey. That creates a richer data trail, but it also makes the analyst’s job more difficult because the signals are spread across more places.
Cost-conscious behaviour adds another complication. When household budgets are under pressure, people may switch to cheaper brands, wait for discounts or buy smaller quantities. A model trained on calmer periods may not fully understand that shift. External pressures can also change the picture quickly. Weather can change demand for food and drink, supply disruption can affect availability, and local events can change footfall. AI can include these signals, but analysts still need to interpret whether the patterns make sense in the current market.
This is why model monitoring matters. A forecasting model should be checked regularly to see where it is making errors. If it consistently underestimates demand in small stores, that suggests the model may not be capturing local behaviour properly. If it overestimates demand after promotions, it may be misunderstanding the temporary effect of discounts.
Final thought
AI demand forecasting is one of the clearest examples of data science becoming part of everyday life. It affects whether products are available, where they are placed, how much waste is created, how promotions are planned and how retailers respond to changing customer behaviour. It is technical, but it is also very human. It is about understanding what people are likely to need and how a business can respond responsibly.
The chewing gum near the checkout is a small example, but it captures the wider principle. Retailers use data to understand behaviour at the moment decisions are made. AI simply extends that principle across larger datasets, faster decisions and more complex supply chains.
Continue developing your data and analytics skills with the Institute of Analytics
As AI becomes more embedded in everyday business decisions, data professionals need more than technical knowledge. They need the confidence to interpret models, communicate findings clearly, and understand how analytics creates value in real organisations. Institute of Analytics membership supports that development through professional resources, learning opportunities, events, and access to a global community of data and analytics professionals.
Explore IoA membership and take the next step in your professional development: https://ioaglobal.org/membership
