Sample output from the Adaptive Demand Forecast & Inventory Buffer Planner prompt in the Sonar AI Prompt Library, run against a NetSuite test account. Every name and number here is test data. Back to the post · The library
TD3016323 · Demand PlanningPrepared 16 September 2026 · Confidential
Ten months of stock on the shelf. Two months is enough.
Furniture and mattress demand for October 2026 – September 2027 under baseline, demand-surge and supply-disruption scenarios, with safety-stock, reorder-point and working-capital recommendations built from 23 months of NetSuite order history.
History / horizonOct 2024 – Aug 2026 (23 months) → Oct 2026 – Sep 2027
GranularityProduct family, monthly; SKU allocation by trailing share
Service target98% cycle service A-class · 95% B/C · holding cost 20%/yr
01
Executive summary
The category sold 1,495 units in the last twelve months and holds 1,311 units today — 316 days of supply, turning 1.15 times a year. Demand is lumpy at SKU level but stable at family level; a statistically defensible buffer at 95–98% service needs roughly 60 days, not 316.
1,600
baseline units forecast, Oct 26 – Sep 27 (+7%)
316 d
current days of supply · turns 1.15
$101K
recommended average inventory (95%, 4 sites)
−$221K
working-capital release vs $322K on hand
Forecast
Baseline 1,600 units/yr (133/month): Mattress 661, Estes Park 600, Ascend/Baja 338. 80% interval on the monthly total ≈ 65–205 units.
Disruption (Bedline/Broyhill lead time 3 → 6 weeks, capacity 60% for 10 weeks): demand unchanged, 123 units unfillable without pre-built stock ($19.8K margin at risk).
Chosen models: SES (mattress), 3-month moving average (Estes Park), SES (tables). Family-level holdout WAPE 16–54%; SKU-level 60–100% — forecast at family, allocate to SKU.
Buffers and capital
Safety stock at 95%, pooled: 174 units / $43K. Distributed across 4 sites (√n rule): $87K. Reorder point 257 units category-wide.
98% is cheaper than 95% for A-class: total holding + lost-margin cost falls from $15.9K to $15.3K because margins ($165–188/unit) dwarf holding cost.
Target average inventory $101K (baseline, 95%, 4 sites) vs $322K today → turns 3.7, DIO 100. Surge and disruption policies need $142K.
Quick win: freeze replenishment on 24 of 29 SKUs with >240 days of cover; sell down ~$180K over two quarters without touching service.
The recommendation is not "hold less inventory." It is hold the right 60 days — sized per SKU on demand and lead-time variability, positioned at the two DCs that ship 88% of volume — and let the other 250 days of stock convert to cash before the next Bedline order is placed.
02
Demand profile and segmentation
Demand = sales-order and cash-sale line quantities by month (order date, not ship date), subsidiaries 1–3. September 2026 is excluded as an incomplete month. Three product families map one-to-one to the three furniture suppliers.
Family
Supplier
SKUs
ABC mix
XYZ mix
Mean / mo
σ
CV
YoY (6 mo)
On hand
Days
Turns
Mattress
Bedline
13
12A · 1B
2Y · 11Z
46.2
33.3
0.72
+63%
494 · $161.7K
282
1.3
Estes Park casegoods
Broyhill
10
4A · 4B · 2C
8Y · 2Z
41.4
11.2
0.27
+25%
511 · $121.1K
332
1.1
Ascend / Baja tables
Flexsteel / Broyhill
6
1B · 5C
4Y · 2Z
25.0
9.9
0.39
−5%
306 · $39.5K
354
0.9
Category
29
16A · 6B · 7C
14Y · 15Z
112.6
—
—
+28%
1,311 · $322.3K
316
1.15
Patterns
Trend
Mattress demand stepped up in March 2026: the last six months averaged 75 units/month against 46 for the full history (+63% YoY). Estes Park grew +25%; tables are flat. A linear fit gives +51%/yr for mattresses, but the step is better read as a level shift than a trend — see model selection.
Seasonality
Indices suggest a Feb–Jul lift for mattresses (1.2–1.6×) and a Dec/Apr/Jun lift for casegoods, but with only 1–2 observations per calendar month the seasonal model was the worst performer on holdout (WAPE 83% for mattresses). Seasonality is not statistically supported at 23 months; re-test when a third year exists.
Volatility
No SKU is X-class (CV < 0.5). Family-level CV is 0.27–0.72; SKU-level CV is 0.7–1.3. The category is stable in aggregate and lumpy in detail — the classic case for family-level forecasting with proportional SKU allocation.
Intermittency
27 of 29 SKUs have average demand interval ≥ 1.32 months (Syntetos-Boylan intermittent boundary); SER_Box Spring has zero demand in 12 of 23 months. Croston was tested for these; it won on 9 SKUs but never at family level.
Outliers
Two category-level spikes: Aug 2025 (Mattress 118; Box Spring alone 30) and Jun 2026 (Mattress 132). Both are retained — the second is part of the level shift, and there is no evidence either was promotion-driven (no promotions calendar in the account).
Stockouts
653 sales-order lines: 2 lines back-ordered (8 units), 0 closed short. Lost sales are negligible; no demand adjustment is applied. This is consistent with 316 days of cover — the category has been over-protected, not under-served.
SKU segmentation — top 12 by annual value
SKU
Family
Class
Units 23 mo
Mean / mo
CV
ADI
Cost
On hand
Days
SER_Box Spring
Mattress
AZ
145
6.30
1.34
2.09
$300
63
303
INV_Estes Park Chest
Estes Park
AY
124
5.39
0.80
1.35
$344
48
278
INV_Contour Rhapsody Breeze Q B
Mattress
AZ
93
4.04
1.05
1.64
$300
38
248
INV_Estes Park Queen Poster Headboard
Estes Park
AZ
80
3.48
1.13
1.64
$338
45
349
INV_Contour Rhapsody Breeze Q M
Mattress
AY
90
3.91
0.97
1.44
$300
36
243
INV_Contour Rhapsody Breeze K B
Mattress
AZ
88
3.83
1.12
1.77
$300
36
239
INV_Estes Park Chair
Estes Park
AY
85
3.70
0.95
1.64
$307.50
54
563
INV_Estes Park Ottoman
Estes Park
AY
89
3.87
0.87
1.53
$288.50
48
287
INV_Contour Rhapsody Breeze F M
Mattress
AZ
85
3.70
1.16
1.77
$300
37
250
INV_Patriarch Luxury Firm T M
Mattress
AY
61
2.65
0.92
1.35
$400
36
469
INV_Patriarch Luxury Firm T B
Mattress
AZ
61
2.65
1.15
1.44
$400
35
328
INV_Patriarch Luxury Firm F B
Mattress
AZ
61
2.65
1.18
1.44
$400
32
299
ABC on 23-month COGS value (A ≤ 70% cumulative, B ≤ 90%). XYZ on CV of monthly demand (X < 0.5, Y < 1.0, Z ≥ 1.0). ADI = average demand interval in months. Days = 365 × on hand ÷ trailing-12-month units. Full 29-SKU table in Appendix A.
Segment summary. AZ 11 SKUs ($297K value, 47%) · AY 5 ($146K) · BY 4 ($78K) · BZ 2 ($38K) · CY 5 ($63K) · CZ 2 ($16K). Eleven of sixteen A-class SKUs are Z-volatility: high value and hard to forecast — the segment where safety stock earns its keep and where the family-level forecast must carry the SKU.
03
Forecast models
Five methods were fitted on months 1–17 (Oct 2024 – Feb 2026) and scored on a 6-month holdout (Mar – Aug 2026). Smoothing parameters were grid-searched on the training window only. Selection rule: lowest WAPE, overridden only when a model within 5 WAPE points cuts absolute bias by more than 10 points.
Family
Method
Parameters
WAPE
MAPE
Bias
Verdict
Mattress
SES
α = 0.10
53.8%
43.3%
−50.4%
Chosen
Holt (linear trend)
α 0.20 · β 0.30
54.6%
42.3%
−53.3%
Holt damped
α 0.10 · β 0.05 · φ 0.80
55.0%
42.5%
−53.9%
Moving average (3)
—
59.7%
47.7%
−59.7%
SES × seasonal index
α 0.20
83.0%
100%
−32.4%
Rejected
Estes Park
Moving average (3)
—
15.8%
15.6%
−6.2%
Chosen
Holt damped
α 0.30 · β 0.30 · φ 0.90
16.0%
15.3%
−9.5%
Holt
α 0.50 · β 0.30
16.2%
15.4%
−10.3%
SES
α 0.50
18.9%
17.7%
−14.3%
SES × seasonal index
α 0.50
22.1%
23.9%
−12.2%
Ascend / Baja
SES
α = 0.20
16.1%
22.6%
+11.2%
Chosen
SES × seasonal index
α 0.10
27.9%
27.3%
+10.9%
Holt
α 0.20 · β 0.30
31.7%
39.1%
+31.7%
Moving average (3)
—
41.9%
51.1%
+41.9%
The mattress holdout is the honest problem in this report. Every method under-forecast Mar–Aug 2026 by 50% or more because the level shifted upward inside the holdout window — exactly the situation a static forecast cannot see coming. The chosen SES (α = 0.1) refitted on all 23 months projects 55 units/month; the last six months averaged 75. Section 07 sets the tracking-signal trigger that would have caught this in May 2026.
SKU-level results and why the forecast is built at family level
The same five methods were run on all 29 SKUs (Croston added for intermittent series). Winners: Holt 13, Croston 9, MA3 3, SES 3, seasonal 1. But SKU-level WAPE ranged 52–100% (median ≈ 70%) — lumpy unit demand of 2–6 per month cannot be forecast precisely at that grain. The operating model is therefore: forecast each family monthly, allocate to SKU by trailing-12-month unit share, and size safety stock per SKU from that SKU's own demand variability. This is standard practice for intermittent A-class items and is what the safety-stock formula in Section 05 assumes.
What makes the model adaptive
Re-estimation cadence
Level and trend states update every month as the prior month closes (exponential smoothing is recursive by construction). Smoothing parameters and model choice are re-searched quarterly on a rolling 6-month holdout.
Tracking signal
TS = cumulative forecast error ÷ mean absolute deviation, per family. |TS| > 4 for two consecutive months → immediate re-fit and model re-selection; |TS| > 6 → escalate to planner review (possible level shift or lost demand). On the mattress series this rule fires in May 2026 — three months into the shift.
Leading indicators in NetSuite
Open sales-order quantity and quantitybackordered (demand already committed); open PO due dates and receipt slippage (supply signal); cash-sale line counts at the two stores (foot-traffic proxy); transfer-order requests from stores to DCs (regional pull).
Scenario switch
The three scenario policies in Section 05 are pre-computed. Triggers in Section 07 move a family from baseline to surge or disruption policy without re-running the analysis.
Prediction intervals
σh = RMSEholdout × √(1 + h·α²) — intervals widen with horizon in proportion to how reactive the model is. Mattress RMSE 51.5, Estes Park 9.2, tables 6.2.
04
Scenario forecasts
Scenario
Assumptions
Annual units
vs last 12 mo
Baseline
Chosen models refitted on all 23 months; no promotions, price or assortment change; Sep 2026 orders already in the system are consistent with the level.
1,600
+7%
High-demand surge
+40% on baseline for Nov 2026 – Jan 2027. Trigger: holiday promotion or a regional competitor exit (both furniture DC customers). Reverts to baseline in Feb.
1,760
+18%
Supply disruption
Demand = baseline. Bedline and Broyhill lead time doubles (3 → 6 weeks, σ 1 → 2 weeks) and supplier capacity falls to 60% for 10 weeks. Trigger: Bay Area event, plant outage or allocation (see the Supply Chain Network Risk Assessment, Sep 2026).
1,600
123 unfillable
Figure 1 — Category demand and scenario forecasts. The disruption scenario follows the baseline demand line; its effect is on supply, shown in Section 05. Intervals combine family RMSEs in quadrature and widen with horizon. The wide band is dominated by mattress volatility (RMSE 51.5 on a mean of 55).
Monthly forecast table (units)
Month
Mattress
Estes Park
Tables
Baseline
80% PI
95% PI
Surge
Disruption supply*
Oct 2026
55
50
28
133
66 – 201
30 – 236
133
80
Nov 2026
55
50
28
133
65 – 201
29 – 237
186
80
Dec 2026
55
50
28
133
65 – 202
29 – 238
186
106
Jan 2027
55
50
28
133
64 – 202
28 – 239
187
133
Feb 2027
55
50
28
133
64 – 203
27 – 239
133
133
Mar 2027
55
50
28
133
64 – 203
27 – 240
133
133
Apr – Sep 2027 (each)
55
50
28
133
61 – 206
23 – 244
133
133
12-month total
661
600
338
1,600
1,760
1,477 (−123)
* Disruption supply = units the two constrained suppliers can deliver if the event starts 1 Oct: 60% capacity for 10 weeks, then a 6-week recovery lag. Level forecasts are flat because the chosen models have no trend or seasonal term; the small drift in the tables family (28.0 → 28.3) is rounding of a residual Holt-free SES level.
05
Safety stock and reorder points
Safety stock is computed per SKU and summed to family, using the combined demand and lead-time variability formula, then converted to days of supply. Cycle stock is half the monthly order quantity (monthly replenishment observed on all three suppliers).
Working for SER_Box Spring baseline: σLTD = √(0.70 × 8.90² + 6.62² × 0.23²) = √(55.45 + 2.32) = 7.60; SS = 1.6449 × 7.60 = 12.5; ROP = 6.62 × 0.70 + 12.5 = 17.1. Disruption: √(1.40 × 79.2 + 43.8 × 0.221) = √120.6 = 10.98; SS = 18.1 — a 45% increase, of which 8 points come from lead-time variance alone.
Family buffers by scenario — pooled across sites
Family
Scenario
d̄ / mo
SS 90%
SS 95%
SS 98%
ROP 95%
SS days 95%
SS value 95%
On hand today
Mattress
Baseline
55.1
61
79
98
112
43
$25.2K
494
Surge
77.1
86
110
137
157
43
$35.3K
Disruption
55.1
89
114
143
182
62
$36.7K
Estes Park
Baseline
50.0
44
57
71
88
34
$13.8K
511
Surge
70.0
62
80
100
124
34
$19.3K
Disruption
50.0
66
85
106
147
51
$20.5K
Ascend / Baja
Baseline
28.2
30
38
47
57
40
$4.3K
306
Surge
39.4
41
53
66
79
40
$6.0K
Disruption
28.2
43
56
70
94
59
$6.4K
Category
Baseline
133
135
174
216
257
39
$43.4K
1,311
Pooled vs distributed. The figures above treat each family as one pool. Stock is actually held at four sites (LA DC 5 and Miami 12 ship 88% of volume; SF 1 and NY 3 the rest). Holding independent safety stock at n sites multiplies it by ≈ √n; at four sites the 95% baseline safety stock becomes ≈ 348 units / $87K. The recommendation in Section 07 uses the distributed figure for the two DCs and treats the stores as transfer-replenished (no independent safety stock), which lands between the two.
Service level vs cost — baseline, category total, pooled
Figure 2 — Service-level trade-off. Because unit margins ($165–188) are large relative to the annual holding cost of one unit ($23–64), the total-cost minimum is at the highest service level tested. The curve flattens above 95%: moving 95 → 98% costs $2.2K more holding and saves $2.8K in lost margin.
Scenario
Service
SS units
Avg inventory (SS + cycle)
Holding / yr
E[short] units / yr
Lost margin / yr
Total
Turns
DIO
Baseline
90%
135
$48.5K
$9.7K
60
$9.7K
$19.4K
7.7
48
95%
174
$58.1K
$11.6K
27
$4.3K
$15.9K
6.4
57
98%
216
$68.9K
$13.8K
9
$1.5K
$15.3K
5.4
68
Surge
90%
189
$67.9K
$13.6K
84
$13.5K
$27.1K
6.0
61
95%
243
$81.4K
$16.3K
37
$6.0K
$22.2K
5.0
73
98%
303
$96.4K
$19.3K
13
$2.1K
$21.4K
4.2
86
Disruption
90%
198
$64.3K
$12.9K
88
$14.2K
$27.0K + $19.8K gap
5.8
63
95%
255
$78.3K
$15.7K
39
$6.3K
$21.9K + $19.8K gap
4.7
77
98%
319
$94.1K
$18.8K
13
$2.2K
$21.0K + $19.8K gap
4.0
92
E[short] = σLTD × L(Z) × 12 cycles, summed over SKUs (standard normal loss function). Lost margin = E[short] × family unit margin (Mattress $188, Estes Park $165, tables $102). "Gap" = 123 units the constrained suppliers cannot deliver during the 10-week disruption regardless of safety-stock policy; covering it requires a pre-built reserve of ≈ $30.5K at cost (Section 07).
06
Working capital impact
Current position: $322.3K on hand against $371.9K trailing-12-month COGS — 1.15 turns, 316 days. Every scenario policy at every service level releases capital; the question is how much and how fast.
Figure 3 — Working capital. Even the most conservative policy (disruption, 98%, four independent sites) holds less than half of current inventory. The lighter segment is the theoretical single-site floor; the darker bar is the practical four-site target.
Scenario · 95% service
Avg inventory
Δ vs current
Holding / yr
Lost margin / yr
Turns
DIO
Current state
$322.3K
—
$64.5K
≈ $0
1.15
316
Baseline — pooled floor
$58.1K
−$264.2K
$11.6K
$4.3K
6.4
57
Baseline — 4 sites Target
$101.5K
−$220.8K
$20.3K
$4.3K
3.7
100
Surge — pooled floor
$81.4K
−$241.0K
$16.3K
$6.0K
5.0
73
Surge — 4 sites
$142.1K
−$180.3K
$28.4K
$6.0K
2.9
127
Disruption — pooled floor
$78.3K
−$244.0K
$15.7K
$6.3K + $19.8K gap
4.7
77
Disruption — 4 sites + $30.5K pre-build
$172.4K
−$150.0K
$34.5K
$6.3K
2.2
169
Net effect of the target policy: release ≈ $221K of working capital, cut annual holding cost from $64.5K to $20.3K (−$44K), and accept ≈ $4.3K/yr of expected lost margin at 95% — or $1.5K at 98% for $2.2K more holding. The disruption reserve is a one-time $30.5K option that protects $19.8K of margin per event; it is worth buying only for the Bedline-supplied mattress line, where no alternate source exists.
07
Recommendations
Buffer strategy by scenario and class
Class
Baseline policy
Surge policy
Disruption policy
A (16 SKUs — all mattresses, 4 Estes Park)
98% service; SS per SKU from Section 05 at LA and Miami; stores hold display + 1 unit, transfer-replenished weekly. ROP-driven monthly PO.
Raise ROP ×1.4 for Nov–Jan on trigger; place the October PO at the surge quantity; revert 1 Feb.
Move to LT 1.4 / σ 0.47 parameters (SS +45%); release the pre-built mattress reserve; allocate to DC customers by margin.
B (6 SKUs)
95% service; same site logic.
ROP ×1.4 on trigger; no pre-order.
95% at disruption parameters; no reserve — Estes Park tables have a Flexsteel alternate.
C (7 SKUs — tables, pillow, drop-ship)
90–95%; consider make-to-order for INV_Baja End Table (Drop Ship) and INV_Baja Rectangular (Special Item) — 1 unit sold in 23 months.
No change.
No change; accept backorder.
Scenario-switching triggers
Trigger
Signal in NetSuite
Threshold
Switch to
Revert when
Demand spike
Family sales-order units, month-to-date, annualised
> 80% PI upper bound (201 units category / 121 mattress) for 1 month, or tracking signal > +4 for 2 months
Surge
2 consecutive months inside the 80% band
Backlog build
Σ quantitybackordered on open SOs per family
> 50% of monthly forecast (28 mattress units)
Surge
Backlog < 10%
Lead-time slip
Open PO lines past expectedreceiptdate / duedate
Any Bedline or Broyhill PO > 14 days late, or 2 POs > 7 days late
Disruption
Two consecutive POs received within 3 days of due
Supplier notice / regional event
Manual — vendor allocation letter, force majeure, Bay Area seismic or wildfire event
Freeze replenishment on the 24 SKUs above 240 days of cover; let stock sell to ROP before the next PO.
316-day cover; $322K tied up
−$180K over 2 quarters
Low
Quick win
Category DIO 316 → < 150 by Mar 2027
2
Load ROP and preferred stock levels into inventoryitemlocations for LA (5) and Miami (12) from Section 05; set stores to transfer-replenish.
No reorder points exist on 25 of 29 SKUs
—
Low
Quick win
% category SKUs with ROP at both DCs → 100%
3
Record real lead times: expected-receipt date on every PO line, receipt dated on arrival, itemvendor.predicteddays populated.
LT and σLT are assumed, not measured
—
Low
Quick win
Measured LT σ available for 100% of A SKUs by Q1 2027
4
Monthly forecast review with tracking signal per family; quarterly parameter re-search.
Mattress level shift went undetected for 6 months
—
Low
Quick win
Family WAPE on rolling holdout < 30%; TS breaches acted on within 1 cycle
5
Rebalance to the DCs: SF and NY stores hold 219 mattress/casegoods units ($~80K) against 12% of volume; transfer surplus to LA/Miami.
Stock positioned where demand is not
Neutral (repositioning)
Medium
Medium term
Store share of category inventory < 15%
6
Build the mattress disruption reserve: 51 units ($16.4K) of the six highest-velocity Contour/Patriarch SKUs at Miami, rotated FIFO.
Bedline sole source; 123-unit gap
+$16K one-time
Medium
Medium term
Mattress fill rate during any LT > 4 weeks event ≥ 90%
7
Convert the two dormant Baja SKUs to drop-ship / special order and retire their stock.
C-class SKUs with 1 unit in 23 months
Small
Low
Quick win
Zero on hand; order-to-ship ≤ vendor LT
8
Re-test seasonality when 36 months exist (Oct 2027); adopt Holt-Winters if the Feb–Jul mattress lift holds.
Seasonality unsupported at 23 months
—
Low
Strategic
Seasonal model beats level model on 12-month holdout
08
Assumptions, data gaps and next steps
Item
Assumption made
Impact on results
Supplier lead time
3 weeks (0.70 mo) ± 1 week baseline; 6 ± 2 weeks in disruption. Receipt dates in the account equal PO dates on 373 of 378 POs, so lead time cannot be measured.
Safety stock scales with √LT; if the true LT is 6 weeks, baseline SS rises ≈ 40%. Action #3 closes this gap in one quarter.
Holding cost rate
20% per year of average inventory at cost (capital + storage + obsolescence).
Linear; at 25% the 98% policy still minimises total cost.
Stockout cost
Lost margin only (price − average cost); no goodwill or expediting cost.
Understates the case for higher service; conservative.
Demand signal
Sales-order + cash-sale line quantity by order date; no cancellations netted (none observed).
Order date leads ship date by ~1–3 weeks; appropriate for replenishment planning.
Promotions and pricing
No promotions calendar or price-change history exists in the account. Average selling prices were not tested for drift.
The Aug 2025 and Jun 2026 spikes cannot be attributed; retained as demand.
History depth
23 complete months (Oct 2024 – Aug 2026) against a 24–36 month ideal.
Seasonality untestable; prediction intervals wider than they will be in a year.
Forecast and SS computed on pooled demand; distributed figure uses √4. Per-site demand split not modelled.
Site-level ROPs in action #2 should apportion by trailing site share (LA 54%, Miami 34%, SF 7%, NY 5%).
Demo-ledger artefacts
Sales-order createddate values are partly synthetic; all analysis windows on trandate.
None on this analysis.
Next steps
Approve actions #1–#4 and #7. Sonar can draft the inventoryitemlocations ROP / preferred-stock updates with a dry-run diff for approval, and a saved search for the tracking-signal and lead-time triggers.
Run the first monthly forecast review at the October close with real September data; the mattress tracking signal is the item to watch.
Re-run this analysis in Q1 2027 once one quarter of measured lead times exists; replace the assumed LT and σLT and re-size the buffers.
Appendix A
Source queries and method
All figures derive from the SuiteQL below, run against the production account on 16 September 2026 and reduced in a sandboxed worker. Item scope: itemid LIKE any of INV_Estes%, INV_Ascend%, INV_Baja%, INV_Leather Square%, INV_Contour%, INV_Patriarch%, SER_Box%.
Q1 · History-depth census by product line 5 rows
SELECT <line CASE> AS line, COUNT(DISTINCT tl.item) AS skus,
COUNT(DISTINCT TO_CHAR(t.trandate,'YYYY-MM')) AS months,
MIN(t.trandate) AS first_sale, MAX(t.trandate) AS last_sale,
SUM(ABS(tl.quantity)) AS units, ROUND(SUM(ABS(tl.netamount)),0) AS revenue
FROM transaction t
JOIN transactionline tl ON tl.transaction = t.id AND tl.mainline='F' AND tl.taxline='F'
JOIN item i ON i.id = tl.item
WHERE t.type IN ('CustInvc','CashSale') AND tl.subsidiary <> 4
AND i.itemtype IN ('InvtPart','Assembly','Kit')
GROUP BY <line CASE>
SELECT tl.item, i.itemid, TO_CHAR(t.trandate,'YYYY-MM') AS ym, t.type,
SUM(ABS(tl.quantity)) AS qty, ROUND(SUM(ABS(tl.netamount)),2) AS amt
FROM transaction t
JOIN transactionline tl ON tl.transaction = t.id AND tl.mainline='F' AND tl.taxline='F'
JOIN item i ON i.id = tl.item
WHERE t.type IN ('SalesOrd','CashSale') AND tl.subsidiary <> 4
AND (<item scope>)
GROUP BY tl.item, i.itemid, TO_CHAR(t.trandate,'YYYY-MM'), t.type
Q3 · On-hand, cost and site split 32 rows
SELECT i.id AS item, i.itemid, i.averagecost, i.parent,
SUM(il.quantityonhand) AS onhand, SUM(il.quantityonorder) AS onorder,
SUM(il.onhandvaluemli) AS onhandvalue,
SUM(CASE WHEN il.location = 5 THEN il.quantityonhand ELSE 0 END) AS oh_la,
SUM(CASE WHEN il.location = 12 THEN il.quantityonhand ELSE 0 END) AS oh_mia,
SUM(CASE WHEN il.location = 1 THEN il.quantityonhand ELSE 0 END) AS oh_sf,
SUM(CASE WHEN il.location = 3 THEN il.quantityonhand ELSE 0 END) AS oh_ny
FROM item i
LEFT JOIN inventoryitemlocations il ON il.item = i.id
WHERE i.itemtype = 'InvtPart' AND i.isinactive = 'F' AND (<item scope>)
GROUP BY i.id, i.itemid, i.averagecost, i.parent
Q4 · Stockout evidence — backorders and short-closed order lines 1 row
SELECT COUNT(*) AS so_lines,
SUM(CASE WHEN tl.quantitybackordered > 0 THEN 1 ELSE 0 END) AS bo_lines,
SUM(COALESCE(tl.quantitybackordered,0)) AS bo_qty,
SUM(CASE WHEN t.status = 'G' AND ABS(tl.quantityshiprecv) < ABS(tl.quantity) THEN 1 ELSE 0 END) AS short_closed,
SUM(CASE WHEN t.status IN ('A','B','D','E') THEN 1 ELSE 0 END) AS open_lines
FROM transaction t
JOIN transactionline tl ON tl.transaction = t.id AND tl.mainline='F' AND tl.taxline='F'
JOIN item i ON i.id = tl.item
WHERE t.type = 'SalesOrd' AND (<item scope>)
-- → 653 lines · 2 back-ordered (8 units) · 0 short-closed · 26 open
Method notes
Models
Simple exponential smoothing (α grid 0.1–0.8); Holt linear trend (α × β grid, β 0.05–0.3); Holt damped (φ 0.8–0.95); 3-month moving average; SES on a 12-month multiplicative seasonal index (two partial years averaged); Croston (SKU level only). Fitted on months 1–17, scored on 18–23, refitted on all 23 for the forecast.
Accuracy
WAPE = Σ|e| ÷ Σ actual (primary — robust to zero months); MAPE over non-zero months; Bias = Σ(forecast − actual) ÷ Σ actual.
Prediction intervals
σh = RMSEholdout × √(1 + h·α²); category interval combines family σ in quadrature (independence assumed).
Segmentation
ABC on 23-month COGS (average cost × units) cumulative 70/90%; XYZ on CV of monthly units 0.5/1.0; intermittency ADI ≥ 1.32.