Skip to content

fix: stickiness cumulative doesn't sum to 100% #31042

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

Merged
merged 1 commit into from
Apr 10, 2025
Merged

Conversation

aspicer
Copy link
Contributor

@aspicer aspicer commented Apr 10, 2025

Problem

Cumulative stickiness should always sum to 100%

Changes

image

Does this work well for both Cloud and self-hosted?

Yes

How did you test this code?

Unit and test in dev

@aspicer aspicer requested a review from a team April 10, 2025 07:07
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR fixes an issue where cumulative stickiness calculations weren't summing to 100% by preserving the original count value before data transformation.

  • Added assertion in posthog/hogql_queries/insights/test/test_stickiness_query_runner.py to verify the count field is correctly set to 3 in cumulative stickiness results
  • Modified posthog/hogql_queries/insights/stickiness_query_runner.py to store the original count value before applying cumulative transformations
  • The fix ensures accurate percentage calculations by using the total user count from original data rather than from transformed cumulative data
  • Test validates the fix with three users having different activity patterns (p1: 3 days, p2: 2 days, p3: 1 day)

2 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@aspicer aspicer enabled auto-merge (squash) April 10, 2025 08:23
@aspicer aspicer merged commit c2c6582 into master Apr 10, 2025
95 checks passed
@aspicer aspicer deleted the aspicer/stickiness_cum branch April 10, 2025 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants