The sales forecasting engine predicts what each customer will buy — and how much revenue they will generate — at the individual customer × item level. Rather than forecasting total item demand across all customers, it produces a separate prediction for every customer and item combination that has sufficient purchase history. This granularity makes it useful not just for procurement planning, but for sales team activity: which customers to prioritise, which accounts are at risk of churning, and where cross-sell opportunity exists.
This article explains how the engine produces its predictions, what the customer intelligence metrics mean, and how automated Sales Orders work.
The sales forecasting engine uses a pattern-learning (Random Forest) model trained per item when there is sufficient history — at least ten data points for a given customer × item combination. The model is trained on calendar signals (month, quarter, day of week), customer and territory identifiers, rolling averages of quantity and amount over 7 and 30 days, lag values from prior periods, trend rates, and the item's selling rate. This feature set allows the model to capture not just recent volume but direction of change.
When the engine generates a forecast, it produces a predicted quantity and revenue potential for the specified forecast period (default 30 days). Confidence is calculated as:
confidence = min(70 + data_points × 2, 95)
A customer × item combination with 12 invoices over the last 90 days would score approximately 94% confidence. If the predicted quantity is zero or below, confidence is reduced by 20 (floor of 50%).
Items must have the Enable Forecast flag set on the Item master to be included. Items without this flag are silently skipped.
When a customer × item combination has fewer than ten data points, the engine falls back to a recency-weighted simple forecast:
base_qty = average quantity over the last 90 days
recency_factor = higher weight for more recent activity
weekend_factor = 0.7 on weekends, 1.0 on weekdays
seasonal_factor = ±10% by month
trend_factor = small daily trend adjustment
predicted_day = base_qty × weekend_factor × seasonal_factor × trend_factor × recency_factor
Confidence on the fallback path is calculated from transaction volume, recency, and stability, capped between 50% and 95%.
For every customer × item forecast record, Foresight calculates four additional metrics beyond predicted quantity and revenue potential.
Customer Score measures buying strength based on purchase frequency and total spend over the last 180 days:
customer_score = 30 + min(purchases × 5, 40) + min(total_value / 10000 × 30, 30)
A customer with 12 invoices and ₹84,000 in total spend at ₹450 per unit would score approximately 81. This helps the sales team identify key accounts at a glance.
Churn Risk is derived from the sales trend:
Increasing trend (predicted quantity > 10) → Low
Stable trend (predicted quantity > 5) → Medium
Decreasing or Critical trend → High
Cross-Sell Score measures the breadth of a customer's purchasing across distinct items:
cross_sell_score = min(30 + distinct_items × 5, 90)
A customer buying 9 distinct items would score approximately 75. A low score indicates a customer buying from a narrow range who may have unmet needs.
Important: The cross-sell score is an informational metric. Foresight does not generate cross-sell recommendations or suggest specific items to a customer. The score is a number for your sales team to interpret and act on.
Every forecast record is assigned a sales trend and movement type on save, derived from the predicted quantity:
Sales velocity is also calculated: sales_velocity = predicted_quantity / forecast_period.
When a forecast meets your configured confidence threshold and the Auto Create Sales Order flag is enabled, Foresight can create a draft Sales Order automatically. The default confidence threshold for auto-SO is 85%.
The auto-SO process selects forecast records where:
The forecast date falls within the next 7 days
The confidence score meets or exceeds the threshold
The predicted quantity is greater than zero
A dedup guard skips any customer and delivery date combination that already has a Sales Order.
Draft Sales Orders are never submitted automatically. Your sales team reviews and submits. The recommended approach is to keep auto-SO off until at least 30 days of accuracy tracking confirms forecasts are trustworthy, then pilot on one customer or item group before expanding.