A planner deciding what to replenish next week needs a different forecast from someone purchasing for the next quarter. This pharmaceutical sales study asks what a strong model score can actually tell us about those two decisions.
Explore sales history, seasonal patterns and 1–12-week projections. The supplied history ends in December 2023; projections begin in January 2024.
Weekly observations
313
Sales categories
8
Input window
26 weeks
Holdout weeks
58
01 / THE PLANNING QUESTION
One series. Two decisions.
Imagine a planner reviewing next week's replenishment and a buyer committing to several months of purchases. Both need to anticipate sales, but they have different horizons and different opportunities to update their information. This is the motivating scenario for the study, not a client engagement.
The supplied dataset spans January 2018 to December 2023. The notebook explores eight sales categories, then models N02BE using 26 weeks of previous sales. Excess inventory and shortages motivate the question, but their costs are not measured here.
Observed sales are the prediction target. Without stock availability and unmet-order data, they should not be treated as a complete measure of demand.
02 / THE OBSERVED SALES
Before the model, look at the series.
A single average cannot describe every week. The largest observation, 128,659.48 sales units on 6 April 2020, sits outside the recorded evaluation period. That is a reason to test across several historical windows before trusting one headline score. N02BE monthly average weekly sales peak in March–May across the six years, with an exceptional March 2020 monthly average. This pattern supports investigating spring purchasing needs; the data alone does not establish a clinical cause.
Observed sales Recorded evaluation period
Weekly sales units (source: Extended Units)
21 Nov 202252,305.78 unitsEvaluation week
Move across the chart or use the slider. Arrow keys step one week; Home and End jump to the first and last observations.
The series ranges from 47,527.89 to 128,659.48 weekly sales units. Shading marks the 58 evaluation targets from 21 November 2022 to 25 December 2023. This is observed sales history, not a forecast or proof of a clinical cause.
Explore all 313 weekly observations
Source: supplied iqvia_pharma_sales.csv. Dates and N02BE values are preserved; provenance is unverified.
Week
Sales units
Evaluation target
2018-01-01
52,374.73
No
2018-01-08
57,653.58
No
2018-01-15
65,380.04
No
2018-01-22
66,801.53
No
2018-01-29
66,841.41
No
2018-02-05
74,106.01
No
2018-02-12
68,311.13
No
2018-02-19
69,055.46
No
2018-02-26
73,169.11
No
2018-03-05
76,668.37
No
2018-03-12
79,071.88
No
2018-03-19
79,241.01
No
2018-03-26
82,116.26
No
2018-04-02
78,902.79
No
2018-04-09
86,993.72
No
2018-04-16
83,542.69
No
2018-04-23
87,157.44
No
2018-04-30
85,238.00
No
2018-05-07
85,454.09
No
2018-05-14
85,423.05
No
2018-05-21
84,522.67
No
2018-05-28
84,241.27
No
2018-06-04
85,058.02
No
2018-06-11
80,795.98
No
2018-06-18
80,757.26
No
2018-06-25
77,039.74
No
2018-07-02
79,421.38
No
2018-07-09
71,914.65
No
2018-07-16
76,630.35
No
2018-07-23
69,711.99
No
2018-07-30
63,969.52
No
2018-08-06
66,130.09
No
2018-08-13
61,972.53
No
2018-08-20
64,119.29
No
2018-08-27
58,272.19
No
2018-09-03
57,093.93
No
2018-09-10
51,633.58
No
2018-09-17
54,056.31
No
2018-09-24
47,527.89
No
2018-10-01
48,737.58
No
2018-10-08
54,197.80
No
2018-10-15
53,674.75
No
2018-10-22
52,358.60
No
2018-10-29
48,522.80
No
2018-11-05
51,130.81
No
2018-11-12
51,640.33
No
2018-11-19
49,178.69
No
2018-11-26
57,178.49
No
2018-12-03
56,588.08
No
2018-12-10
54,937.72
No
2018-12-17
57,082.60
No
2018-12-24
52,177.16
No
2018-12-31
47,722.02
No
2019-01-07
56,080.48
No
2019-01-14
62,524.36
No
2019-01-21
63,726.25
No
2019-01-28
67,747.45
No
2019-02-04
75,410.42
No
2019-02-11
74,373.39
No
2019-02-18
73,130.25
No
2019-02-25
78,113.45
No
2019-03-04
82,132.33
No
2019-03-11
82,522.38
No
2019-03-18
81,701.71
No
2019-03-25
81,119.28
No
2019-04-01
85,830.24
No
2019-04-08
85,898.33
No
2019-04-15
87,893.85
No
2019-04-22
87,604.81
No
2019-04-29
88,874.30
No
2019-05-06
84,535.02
No
2019-05-13
89,158.57
No
2019-05-20
85,571.74
No
2019-05-27
89,782.56
No
2019-06-03
81,329.19
No
2019-06-10
86,576.06
No
2019-06-17
81,012.17
No
2019-06-24
77,125.95
No
2019-07-01
75,820.56
No
2019-07-08
74,385.99
No
2019-07-15
74,417.58
No
2019-07-22
72,656.40
No
2019-07-29
67,660.08
No
2019-08-05
67,073.11
No
2019-08-12
70,849.26
No
2019-08-19
67,766.24
No
2019-08-26
62,422.26
No
2019-09-02
59,587.24
No
2019-09-09
58,181.80
No
2019-09-16
58,045.54
No
2019-09-23
52,389.68
No
2019-09-30
53,377.78
No
2019-10-07
48,755.93
No
2019-10-14
53,694.05
No
2019-10-21
54,000.60
No
2019-10-28
50,864.56
No
2019-11-04
56,524.70
No
2019-11-11
49,420.26
No
2019-11-18
49,426.42
No
2019-11-25
54,836.02
No
2019-12-02
58,149.84
No
2019-12-09
61,175.65
No
2019-12-16
56,943.31
No
2019-12-23
55,561.76
No
2019-12-30
54,174.55
No
2020-01-06
57,436.02
No
2020-01-13
68,030.51
No
2020-01-20
69,510.42
No
2020-01-27
65,669.67
No
2020-02-03
75,985.35
No
2020-02-10
77,831.56
No
2020-02-17
74,501.64
No
2020-02-24
79,195.19
No
2020-03-02
117,285.67
No
2020-03-09
119,118.65
No
2020-03-16
119,159.79
No
2020-03-23
120,773.48
No
2020-03-30
124,140.11
No
2020-04-06
128,659.48
No
2020-04-13
127,935.43
No
2020-04-20
62,109.00
No
2020-04-27
65,286.67
No
2020-05-04
55,516.32
No
2020-05-11
65,977.77
No
2020-05-18
57,805.87
No
2020-05-25
60,893.19
No
2020-06-01
58,096.00
No
2020-06-08
56,706.46
No
2020-06-15
62,227.62
No
2020-06-22
56,680.11
No
2020-06-29
57,573.11
No
2020-07-06
70,494.99
No
2020-07-13
70,055.63
No
2020-07-20
67,081.42
No
2020-07-27
61,505.48
No
2020-08-03
65,680.78
No
2020-08-10
59,781.47
No
2020-08-17
55,082.32
No
2020-08-24
56,338.49
No
2020-08-31
59,848.63
No
2020-09-07
56,579.47
No
2020-09-14
51,997.01
No
2020-09-21
50,802.61
No
2020-09-28
49,878.46
No
2020-10-05
55,517.61
No
2020-10-12
50,408.69
No
2020-10-19
50,201.26
No
2020-10-26
51,709.48
No
2020-11-02
49,725.78
No
2020-11-09
48,765.55
No
2020-11-16
49,539.07
No
2020-11-23
50,702.14
No
2020-11-30
51,834.70
No
2020-12-07
55,121.95
No
2020-12-14
54,728.05
No
2020-12-21
58,128.54
No
2020-12-28
50,716.39
No
2021-01-04
62,062.91
No
2021-01-11
64,757.76
No
2021-01-18
74,813.30
No
2021-01-25
75,599.57
No
2021-02-01
79,694.65
No
2021-02-08
71,608.77
No
2021-02-15
87,286.20
No
2021-02-22
83,568.33
No
2021-03-01
89,067.38
No
2021-03-08
85,336.39
No
2021-03-15
91,633.10
No
2021-03-22
88,849.92
No
2021-03-29
91,474.03
No
2021-04-05
99,517.20
No
2021-04-12
94,869.79
No
2021-04-19
96,693.85
No
2021-04-26
98,899.90
No
2021-05-03
98,073.75
No
2021-05-10
97,043.49
No
2021-05-17
97,233.11
No
2021-05-24
102,036.23
No
2021-05-31
94,515.99
No
2021-06-07
87,108.13
No
2021-06-14
88,080.01
No
2021-06-21
86,725.08
No
2021-06-28
85,266.62
No
2021-07-05
81,970.11
No
2021-07-12
75,244.74
No
2021-07-19
80,640.77
No
2021-07-26
71,081.80
No
2021-08-02
72,822.66
No
2021-08-09
67,846.12
No
2021-08-16
67,581.73
No
2021-08-23
66,582.04
No
2021-08-30
64,601.22
No
2021-09-06
63,030.50
No
2021-09-13
64,532.36
No
2021-09-20
59,904.20
No
2021-09-27
56,711.45
No
2021-10-04
58,842.38
No
2021-10-11
58,571.73
No
2021-10-18
51,465.08
No
2021-10-25
55,982.78
No
2021-11-01
56,149.14
No
2021-11-08
53,624.58
No
2021-11-15
58,523.15
No
2021-11-22
55,105.01
No
2021-11-29
56,762.12
No
2021-12-06
57,114.82
No
2021-12-13
58,991.90
No
2021-12-20
57,582.59
No
2021-12-27
50,936.20
No
2022-01-03
62,664.64
No
2022-01-10
63,919.58
No
2022-01-17
65,651.01
No
2022-01-24
64,720.31
No
2022-01-31
70,995.98
No
2022-02-07
71,381.13
No
2022-02-14
81,515.87
No
2022-02-21
81,947.93
No
2022-02-28
79,431.13
No
2022-03-07
89,223.73
No
2022-03-14
87,580.64
No
2022-03-21
85,666.31
No
2022-03-28
81,227.96
No
2022-04-04
95,237.74
No
2022-04-11
86,310.88
No
2022-04-18
86,314.00
No
2022-04-25
93,894.87
No
2022-05-02
97,859.54
No
2022-05-09
94,931.14
No
2022-05-16
92,368.16
No
2022-05-23
91,827.26
No
2022-05-30
91,647.03
No
2022-06-06
90,283.44
No
2022-06-13
87,672.23
No
2022-06-20
85,666.16
No
2022-06-27
83,509.15
No
2022-07-04
79,793.19
No
2022-07-11
79,072.92
No
2022-07-18
73,203.02
No
2022-07-25
75,326.05
No
2022-08-01
70,755.78
No
2022-08-08
68,261.57
No
2022-08-15
69,545.96
No
2022-08-22
70,701.58
No
2022-08-29
67,432.76
No
2022-09-05
58,886.50
No
2022-09-12
58,717.98
No
2022-09-19
62,342.82
No
2022-09-26
55,839.60
No
2022-10-03
56,741.72
No
2022-10-10
57,925.93
No
2022-10-17
53,215.23
No
2022-10-24
55,711.89
No
2022-10-31
51,740.01
No
2022-11-07
53,858.12
No
2022-11-14
56,748.59
No
2022-11-21
52,305.78
Yes
2022-11-28
58,691.15
Yes
2022-12-05
58,632.90
Yes
2022-12-12
61,563.64
Yes
2022-12-19
62,283.27
Yes
2022-12-26
59,503.64
Yes
2023-01-02
59,847.80
Yes
2023-01-09
66,308.69
Yes
2023-01-16
69,945.92
Yes
2023-01-23
73,299.04
Yes
2023-01-30
74,232.94
Yes
2023-02-06
76,471.40
Yes
2023-02-13
76,710.91
Yes
2023-02-20
78,982.19
Yes
2023-02-27
79,071.90
Yes
2023-03-06
89,467.58
Yes
2023-03-13
83,240.58
Yes
2023-03-20
86,334.26
Yes
2023-03-27
87,681.37
Yes
2023-04-03
93,198.51
Yes
2023-04-10
90,963.82
Yes
2023-04-17
95,799.49
Yes
2023-04-24
91,088.89
Yes
2023-05-01
93,810.70
Yes
2023-05-08
90,722.01
Yes
2023-05-15
98,337.76
Yes
2023-05-22
88,769.91
Yes
2023-05-29
91,892.29
Yes
2023-06-05
91,628.36
Yes
2023-06-12
89,682.00
Yes
2023-06-19
86,514.97
Yes
2023-06-26
84,920.49
Yes
2023-07-03
83,486.74
Yes
2023-07-10
80,948.31
Yes
2023-07-17
81,800.32
Yes
2023-07-24
82,949.39
Yes
2023-07-31
73,304.72
Yes
2023-08-07
68,899.72
Yes
2023-08-14
70,137.47
Yes
2023-08-21
75,154.69
Yes
2023-08-28
64,049.51
Yes
2023-09-04
68,683.96
Yes
2023-09-11
67,028.99
Yes
2023-09-18
59,470.75
Yes
2023-09-25
61,104.41
Yes
2023-10-02
62,792.95
Yes
2023-10-09
56,503.57
Yes
2023-10-16
56,320.13
Yes
2023-10-23
54,918.32
Yes
2023-10-30
53,640.85
Yes
2023-11-06
54,777.46
Yes
2023-11-13
53,666.74
Yes
2023-11-20
57,734.19
Yes
2023-11-27
56,532.26
Yes
2023-12-04
60,418.94
Yes
2023-12-11
57,045.99
Yes
2023-12-18
63,732.51
Yes
2023-12-25
59,133.81
Yes
03 / THE FORECASTING APPROACH
Twenty-six weeks in. One prediction out.
Explore weekly sales. Inspect trends, category correlations and seasonal patterns.
Prepare sequences. All 313 observations remain in the modeling series. The 26-week window produces 229 pre-test sequences and 58 holdout targets. A chronological split reserves 35 pre-test sequences for validation; the scaler is fitted on the initial fitting observations.
Fit a recurrent model. Two LSTM layers with 64 and 32 units feed dense layers with dropout. Validation selects seven training epochs, then the evaluation model is refitted on the pre-test sequences.
Compare at a shared origin. Recursive LSTM, Prophet, ARIMA(2,1,2), persistence and a 52-week seasonal-naive baseline predict the same Monday dates, without receiving holdout sales. A separate all-history LSTM powers the dashboard projections.
04 / THE RECORDED RESULTS
Same origin. Different horizons.
Every benchmark starts on 14 November 2022 and forecasts without new observations. The first 12 weeks cover 21 November 2022 to 6 February 2023. The full 58-week holdout ends on 25 December 2023.
BENCHMARK / SHARED CUTOFF
Compare like with like.
14 Nov 202212 weeks58 weeks
Use only observations available before the holdout
Forecast the same dates for all five models
Inspect the first 12 weeks and the full holdout separately
The LSTM feeds its predictions back into its input window. Persistence repeats the last observation; seasonal naive repeats the preceding 52-week cycle. The comparison uses one forecast origin.
DASHBOARD / ALL-HISTORY MODEL
Explore what comes next.
25 Dec 20231–12 weeks ahead
Load the saved all-history model and matching scaler
Start with the last 26 observed N02BE weeks
Generate recursive weekly point projections
Projections start on 1 January 2024 and extend to 18 March at the maximum horizon. No seasonal multipliers or confidence bands are added. These are historical exploratory sales projections.
Conceptual workflow diagrams. The benchmark evaluates pre-test models; its scores do not independently evaluate the dashboard's all-history refit.
Shared forecast origin: 14 November 2022. 21 November 2022 to 6 February 2023: 12 weekly targets.
Prophet1,639.275 units
LSTM recursive2,612.263 units
Seasonal naive (52 weeks)4,041.085 units
ARIMA(2,1,2)8,384.795 units
Persistence8,415.726 units
Lower is better. All five models forecast the same dates without holdout sales as inputs. These are recorded results at one origin, not evidence of statistical superiority. Source: notebook section 6, cell 29.
Prophet records the lowest MAE at both horizons: 1,639.275 Extended Units over 12 weeks and 3,551.134 over 58 weeks. The seasonal-naive baseline is close on full-holdout MAE at 3,617.887 and has a lower RMSE than Prophet. The recursive LSTM records MAE of 2,612.263 over 12 weeks and 6,299.634 over 58 weeks. Model choice depends on the horizon and error measure; this single origin does not establish a universally best model.
05 / FROM ANALYSIS TO ACTION
What this could mean for planning.
Potential applications, not demonstrated outcomes. Use the observed spring pattern and benchmark results to design a replenishment pilot, with current planning practice as the comparison.
Inventory planners
Recommended action
Review N02BE purchasing and supplier capacity ahead of March–May, allowing for lead times. Confirm the seasonal pattern in recent data before changing orders.
Potential value
Earlier preparation for the observed high-sales period and possible supply constraints.
How to validate it
Compare stockout frequency, service levels, and average inventory against current practice. Use stock availability and supplier lead times to interpret the results.
Procurement and finance
Recommended action
Test Prophet, seasonal naive and recursive LSTM over several 12-week origins before using projections for purchasing or budgets.
Potential value
Better visibility into upcoming purchasing requirements.
How to validate it
Backtest cumulative 12-week errors and forecast bias, incorporating supplier lead times. Translate errors into purchasing costs only when cost data is available.
Category managers
Recommended action
Test whether lagged sales in related categories improve forecasts beyond N02BE history alone.
Potential value
Better coordination of category planning if the signals prove useful.
How to validate it
Compare models with and without those inputs on the same evaluation periods. Co-movement alone does not establish patient substitution or a causal relationship.
06 / INTERPRETING THE EVIDENCE
A useful signal. A bounded claim.
One origin, limited generalisation. The comparison aligns dates and information available to each model, but covers one historical cutoff. ARIMA(2,1,2) is an untuned, nonseasonal baseline. Repeat the comparison across several origins before selecting a model.
Features versus inputs. N02BA and N02BE sales are strongly correlated (Pearson r ≈ 0.949). That suggests testing lagged cross-category signals; it does not show patient substitution. Calendar and category features are explored, but the LSTM receives only past N02BE sales.
Sales, uncertainty and value. Sales can be constrained by stock availability. Point projections do not quantify uncertainty, and the study does not measure inventory savings, service-level gains or shortage costs.
07 / WHAT I RECOMMEND
Match the evidence to the decision.
Prepare for the observed spring pattern. Review purchasing schedules and supplier capacity before March–May. Check recent sales and procurement lead times before setting a seasonal buffer.
Choose a model for the planning horizon. Extend the matched-origin comparison to rolling 1-, 4- and 12-week evaluations. Keep Prophet, seasonal naive and LSTM as candidates; assess bias, underprediction and overprediction as well as average error.
Measure value in a replenishment pilot. Combine forecasts with on-hand inventory, expiry dates, service targets, lead times, and shortage and holding costs. Validate prediction interval coverage, then compare stockout days, expiry waste and inventory costs with current practice.
08 / EXPLORE THE DASHBOARD
Inspect the history. Try the horizon.
The Streamlit dashboard connects eight-category sales charts, an N02BE monthly heatmap, forecast controls and the recorded benchmark tables. Choose 1–12 weeks, inspect the forecast boundary, and download the projected values as CSV.
It loads a saved all-history TensorFlow model and matching scaler. No API key or retraining is needed. The displayed projections begin after the final observation in December 2023, so they should not be read as forecasts for today.
A forecast is useful only for the decision it was evaluated to support. The same model can produce different errors across planning horizons. Matching the forecast origin makes the comparison interpretable; repeated evaluation and operational data are the next steps toward a purchasing decision.