Data & AI

Sales Forecasting with Machine Learning: A Practical Fix

Affix Center · · 9 min read

Sales Forecasting with Machine Learning: A Practical Guide - Affix Center

Quick answer: Sales forecasting with machine learning uses your past sales, prices, promotions, festival calendar and other signals to predict future demand, usually by SKU, branch and week. Start with clean data and a simple baseline, test statistical and gradient boosted models against it, and deliver the forecast inside the tools planners already use.

Most Indian sales teams still forecast the way they did a decade ago. A regional manager fills a spreadsheet, the head of sales adjusts it, and finance trims it before the board meeting. The final number is part data, part hope, and the cost shows up later as stock-outs on fast movers and dead stock on slow ones.

The real problem is not a lack of data. Most distributors, manufacturers and retailers already hold years of invoices in their ERP or accounting system. The data sits in silos, is inconsistent, and nobody has time to turn it into a forecast the team trusts. This guide explains how sales forecasting with machine learning works, which methods suit which situation, and a practical method to get from raw sales records to a working forecast.

Why Spreadsheet Forecasts Keep Missing

Spreadsheet forecasts usually rely on last year's number plus a growth percentage. That approach breaks down in several common situations:

  • Shifting festival dates. Diwali, Ganesh Chaturthi and Eid move across the calendar every year. A simple month-on-month comparison misreads the demand spike.
  • Large product ranges. A distributor with thousands of SKUs cannot hand-forecast each item for each branch. Planners end up forecasting only the top sellers and guessing the rest.
  • Promotions and price changes. Discounts pull demand forward, and the dip that follows is often mistaken for a real slowdown.
  • Stock-outs hide demand. When an item was out of stock, recorded sales understate what customers wanted, and next year's forecast starts too low.
  • Bias. Sales teams tend to under-forecast to beat targets, while management tends to over-forecast to meet plans.

Machine learning does not remove judgement. It gives planners a consistent, explainable baseline to start from, so discussions focus on real changes rather than on whose spreadsheet is right.

How Sales Forecasting with Machine Learning Works

A forecasting model learns patterns from past data and projects them forward. It looks at how sales moved with time, season, price, promotions, holidays and other inputs, and uses those patterns to estimate future demand, ideally as a range rather than a single number.

The main approaches fall into a few groups, and a good project compares several of them against a simple baseline.

MethodHow it worksBest suited forLimitations
Baseline (last year same period, moving average)Repeats or averages recent historyA benchmark every model must beatIgnores promotions, price, festivals and trend changes
Statistical time series (exponential smoothing, ARIMA)Models trend and seasonality of one series at a timeStable products with a long, regular historyHard to add many outside factors, weak for new or patchy items
Gradient boosted trees (XGBoost, LightGBM)Treats forecasting as regression using many inputs at onceSKU and branch forecasts across large catalogues with promotions and festivalsNeeds careful feature design and testing over time
Deep learning modelsNeural networks learn patterns across thousands of related seriesVery large datasets with many related products and locationsMore data, computing and skill needed, harder to explain

For most mid-sized Indian businesses, statistical models and gradient boosted trees give the best balance of accuracy and explainability. Deep learning is worth testing only after simpler models are working.

What Data You Need

Data preparation takes most of the effort in any forecasting project. Before building a model, make sure you have:

  • Sales history of at least two to three years, at the level you want to forecast, such as SKU by branch by week.
  • Stock-out flags so periods with no stock are not read as low demand.
  • Clean master data, with duplicate customer and product codes merged and discontinued SKUs mapped to their replacements. Our guide on cleaning duplicate customer data shows how.
  • Returns and cancellations, recorded so they do not inflate sales.
  • A calendar table with Indian festivals, public holidays, month-end billing patterns and the March financial year end.
  • Price and promotion history, including scheme periods and dealer offers.
  • External signals where useful, such as monsoon progress for agri-inputs or school reopening dates for stationery.

If your data sits across Tally, an ERP and several Excel files, a small data pipeline or a data warehouse that pulls everything into one place is usually the first deliverable.

The Fix: A Step-by-Step Method

Follow these steps to move from spreadsheet guesses to a machine learning forecast that planners use.

  1. Define the decision. Agree what the forecast is for, such as purchase orders, production plans or branch stock, and at what level and horizon, for example SKU by branch for the next 12 weeks.
  2. Collect and clean the data. Pull sales, stock, price, promotion and calendar data into one place, fix master data and flag stock-out periods.
  3. Set a simple baseline. Use last year's same period or a moving average. Any model must beat it clearly to be worth running.
  4. Test several models over time. Train on data up to a cut-off date, forecast the following weeks, and repeat for several cut-offs. This method is called backtesting.
  5. Measure error in business terms. Use weighted measures such as WAPE, the total absolute error divided by total actual sales, and check bias so a model that is always high or low is caught.
  6. Forecast ranges, not single numbers. Give planners a likely range so they can set safety stock and see risk.
  7. Deliver the forecast where people work. Push numbers into the ERP, a planning sheet or a dashboard the team already opens every day.
  8. Let planners override, and record why. Human knowledge of a new dealer or a lost contract still matters, and recorded reasons help improve the model.
  9. Retrain and review every month. Track accuracy by product group and branch, retrain on new data, and review results with sales, supply chain and finance together.

Common Mistakes and How to Avoid Them

  • Starting with the most complex model. Begin simple and add complexity only when it improves tested accuracy.
  • Testing on the same data the model learned from. Always test on later periods the model has not seen.
  • Judging only average accuracy. A model that is right on average but wrong on top sellers still hurts. Check accuracy for the items that matter most.
  • Building a model nobody sees. If forecasts sit in a data science notebook, they will not change any decision.
  • Ignoring explainability. Planners trust a forecast more when they can see that a spike comes from a festival week or a planned promotion.

Where to Start if You Are New to This

Pick one product category or region where forecast errors clearly cost money, for example frequent stock-outs on a fast-moving range. Run a pilot of eight to twelve weeks that compares the model against the current forecast, using the same accuracy measure for both. Show the results in a simple MIS dashboard so management can judge them. If the pilot shows better accuracy and lower stock or fewer stock-outs, extend it to more categories and connect it with your inventory management software for reorder planning.

Frequently Asked Questions

How much data do we need for sales forecasting with machine learning?

Two to three years of history at the level you want to forecast is a sensible minimum, because it captures at least two full seasonal cycles. New products can borrow patterns from similar items until they build their own history.

Which machine learning model is best for sales forecasting?

There is no single best model. Statistical models suit stable items with long history, while gradient boosted trees often work well across large catalogues with promotions and festivals. Test several against a baseline on your own data.

How accurate can a machine learning sales forecast be?

It depends on the product, level of detail and data quality. Forecasts at total company level are usually more accurate than at SKU and branch level. Measure accuracy with backtesting on your own data instead of relying on general claims.

Do we need a data science team to start?

Not necessarily. Many businesses start with an external partner for the first pilot and data pipeline, then train an internal analyst to review results and manage overrides.

Can machine learning forecasts work with Tally or our ERP?

Yes. Sales and stock data can be extracted from Tally or an ERP into a central store, the model runs on that data, and forecasts are pushed back into the ERP, a planning sheet or a dashboard.

How Affix Center Can Help

Affix Center is a Mumbai-based IT company that builds data pipelines, forecasting models and dashboards for businesses that want planning based on evidence. Our data, AI and automation services cover data clean-up, model building, backtesting and integration with your ERP. If you are still deciding where analytics fits in your plans, our enterprise advisory team can help you prioritise.

Want a forecasting pilot on one product range? Contact Affix Center to discuss your data and goals.