PostHog / PostHog/posthog

28-day average smoothing should average with earlier data than time period

Open
#51,652 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement feature/insights team/product-analytics
Dominant language
Python
Stars
39.9k
Forks
3.4k
Avg merge
6h 51m
Merged PRs (30d)
232

Description

Feature request

Is your feature request related to a problem?

The smoothing can be a bit misleading early on because it's averaging less data.

It looks like the way this works currently is that the first ~27 days are averaged over fewer days. For example, with daily data and 28-day smoothing:

  • Day 1: average of just day 1 (= raw value)
  • Day 2: average of days 1–2
  • Day 3: average of days 1–3
  • ...
  • Day 28+: full 28-day trailing average

Describe the solution you'd like

Pull more data ahead of the chosen time period but only use the data from the time period.

Describe alternatives you've considered

Additional context

Ticket: https://posthoghelp.zendesk.com/agent/tickets/53621 (moved to PostHog: https://us.posthog.com/project/2/support/tickets/55493)

Debug info
- [ ] PostHog Cloud, Debug information: [please copy/paste from https://us.posthog.com/settings/project-details#variables]
- [ ] PostHog Hobby self-hosted with `docker compose`, version/commit: [please provide]
- [ ] PostHog self-hosted with Kubernetes (deprecated, see [`Sunsetting Kubernetes support`](https://posthog.com/blog/sunsetting-helm-support-posthog)), version/commit: [please provide]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, entry points, or tests. Start by locating the analytics smoothing implementation and its existing test coverage; verify how the selected period and 28-day window are calculated. Done means early points use earlier data for smoothing while only values within the chosen period are displayed, with tests covering the initial days.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
analytics
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.