Forecasting demand in an unstable economy

Economic uncertainty, disrupted transport routes, volatile demand and limited financing have forced Ukrainian businesses to revisit how they plan. Models developed under stable conditions may perform poorly during wartime. Scenario modeling, reliable data and links to operational systems help planners adapt.

Planning under uncertainty in late 2023

Ukrainian businesses adapted to the full-scale war by rebuilding logistics routes, adjusting production and developing new sales channels. Disrupted export routes, labor shortages, security risks and the cost of maintaining backup infrastructure continued to shape operating plans.

A change in transport route can alter unit costs. Losing a supplier can interrupt production. Reopening a regional warehouse can improve availability and sales, while changes in staffing affect capacity. Demand models often draw on prior sales, seasonality and market trends, and inventory plans may rely on historical lead times. When operating conditions change, identify which of those relationships still hold and plan for several possible outcomes.

Structural breaks in historical data

A structural break occurs when a process changes enough that relationships observed in earlier data no longer apply in the same way. February 24, 2022 marked a clear break for many Ukrainian businesses. Further changes followed as companies relocated production, switched suppliers, worked around power constraints and rebuilt export routes. A company that moved shipments from ports to road and rail, for example, would need to reassess a logistics cost model built around sea freight.

Illustrative measure202120222023
Average lead time7 days21 days14 days
Logistics cost per unitUAH 100UAH 185UAH 160
Share of urgent purchases5%22%14%
Demand forecast accuracy88%61%73%
Core assortment availability97%76%86%

An average across all three years may describe none of the actual operating conditions. Earlier data can still reveal seasonality, customer behavior and long-term trends. Label the periods with different operating conditions so the model can use historical observations where they remain relevant.

Building the planning dataset

Combine ERP transactions, purchases, production and finance with customer orders from CRM, stock balances from warehouse systems and routes, costs and delivery times from transport systems. Bring in approved master data, budget limits and relevant external indicators such as exchange rates. Use ETL or change data capture to load the warehouse, reconcile measures across systems and preserve the history of organizational changes.

Use the resulting history to model demand, inventory, logistics and cash flows. Keep actuals, forecasts and scenario inputs distinct and version each model and scenario. A projected material price belongs in planning data, while the actual purchase price belongs in the transaction history. Scenario exchange rates should not overwrite financial records.

Planning for baseline, adverse and recovery scenarios

A baseline uses the assumptions best supported at the planning date. An adverse scenario tests delays, rising costs, lower demand or an unavailable site. A recovery scenario tests improved resource availability and the return of sales channels. Where the evidence is insufficient to estimate probabilities, use the scenarios to see how sensitive decisions are to changes in assumptions.

Illustrative first-quarter 2024 planAdverseBaselineRecovery
Units sold8,00010,00012,000
Unit price (UAH)1,2001,2001,200
Revenue (million UAH)9.612.014.4
Variable costs (million UAH)7.28.610.0
Fixed costs (million UAH)2.32.32.3
Operating result (million UAH)0.11.12.1

The example excludes VAT, financing costs, depreciation adjustments and working capital changes. The adverse case might prompt management to defer noncritical purchases, reschedule production or hold more liquidity. The recovery case might justify planning another shift or stocking additional materials.

Forecasting demand when operations change

Alongside historical sales, seasonality, prices and campaigns, consider changes in regional access, customer geography, production sites, lead times, stock, power, transport and staffing. Sales can fall when stock runs out even if customer demand holds up. Include unfulfilled orders, declined requests and periods of stock unavailability when those data are available.

MethodStrengthLimitation
Moving averageSimple and transparentSlow to react to structural changes
Exponential smoothingRelatively simple to fitDepends on persistent patterns
ARIMA and SARIMAModel time-series structureRequire testing their assumptions
RegressionCan incorporate external factorsSensitive to feature quality
Trees and ensemblesCan capture nonlinear relationshipsCan overfit
Expert scenariosCan reflect new circumstancesDepend on judgment
Combined methodsIncorporate statistics and expertiseHarder to govern

Improving input data can help even a simple model. Adding stock availability, for example, helps distinguish lower sales caused by shortages from lower demand.

A Python forecasting example

The following example fits an additive trend to illustrative monthly sales and forecasts three months ahead.

import pandas as pd
from statsmodels.tsa.holtwinters import ExponentialSmoothing

sales = pd.Series(
    [8200, 8400, 8100, 8700, 9100, 9300, 8900, 9500, 9800, 10100, 9700, 10300],
    index=pd.date_range(start="2023-01-01", periods=12, freq="MS"),
)
model = ExponentialSmoothing(sales, trend="add", seasonal=None)
result = model.fit(optimized=True)
print(result.forecast(3))

Before using the model in planning, check whether the history is long enough and whether structural breaks, seasonality, price changes or shortages affect the results. Test it with rolling-origin backtesting. At each historical cutoff, train using only the information available at that time, forecast subsequent periods and compare the result with actual values. Randomly mixing observations across time can overstate accuracy, particularly when operating conditions changed.

Inventory buffers under uncertain lead times

If daily demands are independent and identically distributed, and lead time in whole days is independent of demand, the variance of total demand over lead time is:

σ²ᴅʟ = L̄ × σᴅ² + D̄² × σʟ²

Here L̄ and D̄ are mean lead time and mean daily demand. The terms σᴅ and σʟ are their respective demand and lead-time standard deviations. Approximate safety stock as z × σᴅʟ, with z chosen for the target service level under the model assumptions. Where demand and lead time are related or distributions differ substantially from the assumed shape, test critical materials under several scenarios.

Use tighter controls and buffers for components that can halt production. Compare lead times when suppliers are interchangeable, model scenarios for rare items, and use shorter horizons for perishables. Balance carrying cost against the impact of shortages.

Forecasting cash flow separately from profit

A profitable business can face a cash shortfall when customers pay late and suppliers require deposits. Build a rolling cash forecast from receivables, payables, payment schedules, sales and procurement plans, payroll, rent, energy costs and tax obligations. For example, update the next 13 weeks each week.

Illustrative cash forecastBaselineAdverse
Opening cashUAH 5.0 millionUAH 5.0 million
Expected receiptsUAH 12.0 millionUAH 8.5 million
Operating paymentsUAH 10.0 millionUAH 10.5 million
Closing cashUAH 7.0 millionUAH 3.0 million

Both scenarios end with positive cash, but the difference can affect investment plans. Make expected receipt dates explicit. The face value of a receivable gives no assurance about when it will be paid.

Checking the data before forecasting

A missing branch feed can look like falling demand. A warehouse that receives a new code after relocation can look like a new facility. A unit change can make current sales incomparable with historical sales.

Quality dimensionExample riskControl
CompletenessMissing branch salesCheck source coverage
ConsistencyDifferent warehouse codesResolve codes through master data
TimelinessDelayed ETLMonitor freshness
AccuracyIncorrect priceReconcile with ERP
UniquenessDuplicate orderCheck business keys
ValidityUnexpected unit of measureValidate units
Historical consistencyReorganizationPreserve historical mappings

Distinguish missing data from zero sales. Record whether the source was available and complete before the model interprets a zero.

Versioning forecasts and assumptions

Keep earlier forecasts so teams can compare what was known at different dates and see which assumptions held. A PostgreSQL registry can store run metadata separately from the resulting forecasts:

CREATE TABLE forecast_runs (
    forecast_id BIGSERIAL PRIMARY KEY,
    model_name VARCHAR(100) NOT NULL,
    model_version VARCHAR(40) NOT NULL,
    scenario_name VARCHAR(50) NOT NULL,
    generated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
    training_data_cutoff DATE NOT NULL,
    assumptions JSONB NOT NULL
);

CREATE TABLE forecast_values (
    forecast_id BIGINT NOT NULL REFERENCES forecast_runs(forecast_id),
    period_start DATE NOT NULL,
    metric_code VARCHAR(100) NOT NULL,
    forecast_value NUMERIC(18, 4) NOT NULL,
    PRIMARY KEY (forecast_id, period_start, metric_code)
);

Compare the October 1 and December 1 runs with actual results. Preserve the input dataset version or a way to reproduce it so reviewers can distinguish changes in data, assumptions and model logic.

Choosing tools for the workload

A relational database such as PostgreSQL can hold historical data and control tables. Python and statsmodels can handle statistical forecasts, and the existing BI platform can display scenarios. Airflow can schedule and monitor loads, Kafka can carry streaming events, and Spark can distribute processing when data volume warrants it. Prioritize reliable input data, reproducible runs and sound evaluation when deciding what to deploy.

Implementation example for a manufacturer

Consider a Ukrainian component manufacturer that used annual budgets, quarterly production plans and historical sales forecasts before the full-scale invasion. In 2022–2023, some customers reduced purchases, new customers arrived, logistics routes changed and material lead times became less predictable.

  1. Inventory ERP, CRM, warehouse and finance data. Mark incomplete periods and distinguish conditions before the invasion, during relocation and after operations resumed.
  2. Produce a three-month forecast for each main product group and compare it with a simple baseline.
  3. Develop three sets of assumptions for sales, logistics, purchase prices and production capacity. Translate each into a cost and cash-flow forecast.
  4. Verify sales coverage, product mappings, inventory freshness and financial totals. Update forecasts monthly and revisit critical assumptions when conditions change.

A 12-week pilot could spend two weeks each on source and metric inventory, data quality and historical periods, baseline models, scenario assumptions, financial integration, and pilot reporting.

Measuring forecast performance

Track mean absolute error (MAE), weighted absolute percentage error (WAPE) and systematic bias. Monitor data completeness, time to refresh forecasts, scenario coverage for critical risks, stock availability, stockouts, cash-flow forecast accuracy and the time needed to prepare decisions.

To calculate WAPE, divide the sum of absolute forecast errors by the sum of absolute actual values and multiply by 100. WAPE is undefined when all actuals are zero, and aggregate results can hide errors in low-volume groups. Compare several metrics and inspect results by segment.

Using forecasts in decisions

Review structural breaks before fitting a model and keep sales distinct from demand. Check for missing feeds and prevent leakage of information that was unavailable at the forecast date. Benchmark complex models against simpler ones, retain assumptions, and ask operational teams to verify constraints. Translate projected volumes into financial and liquidity effects.

Use the warehouse and master data to compare periods and reproduce forecasts. Prepare responses for alternative outcomes and review them as conditions change. The forecast gives decision-makers a basis for judging risks and choosing actions.