diff --git a/apps/dashboard/src/app/team/[team_slug]/(team)/~/analytics/page.tsx b/apps/dashboard/src/app/team/[team_slug]/(team)/~/analytics/page.tsx index 1ba33619388..217dace6e70 100644 --- a/apps/dashboard/src/app/team/[team_slug]/(team)/~/analytics/page.tsx +++ b/apps/dashboard/src/app/team/[team_slug]/(team)/~/analytics/page.tsx @@ -257,7 +257,10 @@ function UsersChartCard({ } data={timeSeriesData} aggregateFn={(_data, key) => - timeSeriesData[timeSeriesData.length - 2]?.[key] + // If there is only one data point, use that one, otherwise use the previous + timeSeriesData.filter((d) => (d[key] as number) > 0).length >= 2 + ? timeSeriesData[timeSeriesData.length - 2]?.[key] + : timeSeriesData[timeSeriesData.length - 1]?.[key] } // Get the trend from the last two COMPLETE periods trendFn={(data, key) => diff --git a/apps/dashboard/src/app/team/[team_slug]/[project_slug]/page.tsx b/apps/dashboard/src/app/team/[team_slug]/[project_slug]/page.tsx index fee25daf6cf..44ce7556077 100644 --- a/apps/dashboard/src/app/team/[team_slug]/[project_slug]/page.tsx +++ b/apps/dashboard/src/app/team/[team_slug]/[project_slug]/page.tsx @@ -279,7 +279,10 @@ function UsersChartCard({ queryKey="usersChart" data={timeSeriesData} aggregateFn={(_data, key) => - timeSeriesData[timeSeriesData.length - 2]?.[key] + // If there is only one data point, use that one, otherwise use the previous + timeSeriesData.filter((d) => (d[key] as number) > 0).length >= 2 + ? timeSeriesData[timeSeriesData.length - 2]?.[key] + : timeSeriesData[timeSeriesData.length - 1]?.[key] } // Get the trend from the last two COMPLETE periods trendFn={(data, key) =>