-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add human friendly comparison periods toggle #27176
base: master
Are you sure you want to change the base?
feat: Add human friendly comparison periods toggle #27176
Conversation
https://github.com/PostHog/posthog/actions/runs/12520844708/job/34927105170?pr=27176 is failing but this is wrong. We can safely add a non-null field with a default on Postgres v11+ - which we are. See https://www.reddit.com/r/programming/comments/bw0vgm/psa_postgresql_11_allows_you_to_create_a_nonnull/ How can we sort this out? |
0460a11
to
a298ea9
Compare
📸 UI snapshots have been updated16 snapshot changes in total. 0 added, 16 modified, 0 deleted:
Triggered by this commit. |
This toggle in the backend allows us to do "human friendly" comparisons, i.e. consider month as 52 weeks and month as 4 weeks. This makes the comparison table slightly nicer to look at, at the cost of not aligning 100% of the time because a month = 30d and a year=365s are slightly more than 4 weeks and 52 weeks, respectively Follow-up commit will add the toggle to the UI
You can now toggle that in the UI on `settings/environment-product-analytics#human-friendly-comparison-periods`
455be0d
to
603eeba
Compare
📸 UI snapshots have been updated16 snapshot changes in total. 0 added, 16 modified, 0 deleted:
Triggered by this commit. |
Problem
Some customers have seasonal data, where data repeats on specific days of the month/year and they'd like to compare against them. The problem is that if you set "compare against last year" but look at data day to day, then it will be misaligned because the days of the week aren't the same year after year.
Changes
This toggle allows us to do "human friendly" comparisons, i.e. consider month as 52 weeks and month as 4 weeks. This makes the comparison table slightly nicer to look at, at the cost of not aligning 100% of the time because a month = 30d and a year=365s are slightly more than 4 weeks and 52 weeks, respectively
I've put the configuration inside "Product Analytics" rather than "Web Analytics" because this applies globally - it's a team-based setting.
Does this work well for both Cloud and self-hosted?
Yep
How did you test this code?
Automated tests + manual UI testing