diff --git a/services/dataProcessor.ts b/services/dataProcessor.ts index 3a16687..3669ae1 100644 --- a/services/dataProcessor.ts +++ b/services/dataProcessor.ts @@ -1654,7 +1654,19 @@ export const calculateForecastViewData = ( // Use referenceData if provided (for global weights), otherwise fallback to rawData const seasonalitySource = referenceData || rawData; const historicalData = seasonalitySource.filter(r => r.year < 2026); - const data2026 = seasonalitySource.filter(r => r.year === 2026); + + // IMPORTANT: Actuals for 2026 must be strictly scoped to the forecast region + // to avoid mixing UK stats into Pan-EU or vice-versa. + const isForecastUKMode = filters?.customer?.includes('Amazon UK'); + const data2026 = rawData.filter(r => { + if (r.year !== 2026) return false; + if (isForecastUKMode) { + return r.customer === 'Amazon UK'; + } else { + // In Pan-EU mode, explicitly exclude UK units even if they are in the dataset + return r.customer !== 'Amazon UK'; + } + }); // Calculate Seasonality weights for 2025 const getWeightsInfo = (records: SalesRecord[]): { weights: number[]; monthsCount: number } | null => {