Why Use a Linear Trend in Daily Forecast Adjustment Instead of Average Sales?

Why Use a Linear Trend in Daily Forecast Adjustment Instead of Average Sales?

Linear Trend in Daily Forecast Adjustment

Why a Linear Trend Is Needed

Demand for products does not always remain stable. Sales may gradually increase or decrease due to the introduction of new products, changes in product placement, competitor activity, price changes, or demand cannibalization.

If only the average sales value is used, the system assumes that demand remains stable (stationary). However, in real retail, this is not always the case.

To account for such changes, MySales uses a linear trend in Daily Forecast Adjustment.

Its purpose is not simply to average past sales but to identify the direction of demand changes and carry it forward into the future forecast.

This helps the system respond more quickly to increases or decreases in sales and reduce the risk of underordering or overordering.

How the Linear Trend Works

During daily adjustment, MySales uses two approaches to sales analysis:

Approach

How It Works

Key Feature

Approach

How It Works

Key Feature

Average Value

Smooths out random sales fluctuations

Works well when demand is stable but does not account for its dynamics

Linear Trend

Analyzes how sales change over time

Helps account for gradual increases or decreases in demand

If sales have been increasing over the last 2–3 weeks, using only the average may underestimate the Forecast. If sales are declining, it may overestimate it.

Therefore, MySales considers both the average sales level and the direction of its change.

How the Trend Is Calculated

Within the daily adjustment algorithm (updateDaily.js), after selecting up to 7 valid days, the system calculates:

  • avgWeek — the average weekly sales value.

  • trendWeekAvg — a value based on linear regression using dayNumber.

  • trendShare — a coefficient that determines the contribution of the trend to the final calculation.

The final value is calculated using the formula:

Week = trendShare × trendWeekAvg + (1 − trendShare) × avgWeek

If the trend is disabled (trendRegular = null or trendPromo = null), the system uses only the average value.

Examples of Use

1. Increasing Demand

SKU sales are gradually increasing:

  • Average Value - 13 units

  • Trend for the Next Week - ≈ 17–18 units

Sales example: 10 → 12 → 14 → 16.

If only the average is used, the Forecast may remain lower than actual demand. This leads to systematic underordering of the product.

The linear trend helps account for demand growth in the future forecast.

2. Decreasing Demand

SKU sales are gradually declining:

  • Average Value - 16.25 units

  • Trend - ≈ 10–11 units

Sales example: 20 → 18 → 15 → 12.

If only the average is used, the Forecast may be overestimated, leading to excessive orders, stock accumulation, and write-offs.

The linear trend helps account for declining demand and avoid overordering.

3. New Product or Distribution Expansion

For new SKUs and products whose distribution is expanding, demand is still forming. In such cases, the average sales value often does not reflect the current situation.

The linear trend helps MySales respond more quickly to changes in demand and account for them in the Forecast.

How the Trend Is Used in Daily Adjustment

The linear trend is part of the Daily Forecast Adjustment algorithm.

During the calculation, MySales:

  1. Analyzes the last 28 calendar days to evaluate current sales.

  2. Selects up to 7 valid days, cleaning the data of OOS and anomalies.

  3. Accounts for price, seasonality, and weather during adjustment.

  4. Calculates the average value and linear trend separately for Regular and Promo.

  5. Uses the results for Daily Forecast Adjustment.

This allows the system to:

  • Respond quickly to changes in demand without waiting for the weekly recalculation.

  • Correctly account for frequent OOS.

  • Strengthen the upward Forecast adjustment (forecast uplift) in cases of systematic shortages.

Trend Settings and Limitations

The linear trend is not always used. When there is insufficient data, its application may amplify random fluctuations and create Forecast instability.

MySales provides separate parameters for Regular and Promo to control the trend.

Parameter

Value

Parameter

Value

trendRegular = null

Trend for Regular is disabled

trendPromo = null

Trend for Promo is disabled

undefined

The default value — 4 — is used

If the trend is disabled, the system uses only the average value.

Adjustment Limitations

To avoid Forecast instability when there is insufficient data, the following limitations apply:

Condition

Maximum Change

Condition

Maximum Change

Slow-moving SKU — products with a low sales frequency

×2

Fewer than 4 days of sales

×3

New product or first Promo

Up to ×6

These limitations help prevent forecast instability and excessive influence of random fluctuations when there is insufficient data.

Result

The linear trend in daily adjustment helps MySales:

  • Identify the direction of demand changes, rather than just its average level.

  • Respond more quickly to increases or decreases in sales.

  • Reduce the risk of systematic underordering and overordering.

  • Account for changes in demand for new products and changes in customer purchasing behavior.

The key difference: the average shows what demand was, while the linear trend shows the direction in which it is changing.

In Replenishment logic, these approaches may produce fundamentally different results.