diff --git a/App.tsx b/App.tsx index bc1cba2..0ef46ac 100644 --- a/App.tsx +++ b/App.tsx @@ -525,6 +525,20 @@ const App: React.FC = () => { }); }, [combinedAdsData, gridContext.maxWeek]); + // Derived Data for Dashboard (YTD Filtered - Isolated) + // Dashboard needs aggregated data respecting the max week limit of current year. + const ytdFilteredData = useMemo(() => { + return filteredData.filter(r => r.week <= gridContext.maxWeek); + }, [filteredData, gridContext.maxWeek]); + + const ytdFilteredAdsData = useMemo(() => { + return filteredAdsData.filter(r => r.week <= gridContext.maxWeek); + }, [filteredAdsData, gridContext.maxWeek]); + + const ytdAggregatedData = useMemo(() => { + return aggregateData(ytdFilteredData); + }, [ytdFilteredData]); + // Derived Data for Views const years = useMemo(() => getUniqueValues(rawData, 'year').sort().reverse(), [rawData]); @@ -701,7 +715,7 @@ const App: React.FC = () => {
- +
}>