Skip to content

Commit

Permalink
max(max_steps)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuziontech committed Nov 14, 2024
1 parent 6dda214 commit 34370ca
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion posthog/hogql_queries/insights/funnels/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ def _get_step_counts_query(self, outer_select: list[ast.Expr], inner_select: lis
)
),
group_by=group_by_columns,
having=parse_expr("steps = max_steps"),
having=parse_expr("steps = max(max_steps)"),
)

def actor_query(
Expand Down
2 changes: 1 addition & 1 deletion posthog/queries/funnels/funnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def get_step_counts_query(self):
{steps_per_person_query}
)
) GROUP BY aggregation_target, steps {breakdown_clause}
HAVING steps = max_steps
HAVING steps = max(max_steps)
"""

def get_step_counts_without_aggregation_query(self):
Expand Down
4 changes: 2 additions & 2 deletions posthog/queries/funnels/funnel_strict.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def get_step_counts_query(self):
SELECT aggregation_target, steps, max(steps) over (PARTITION BY aggregation_target {breakdown_clause}) as max_steps {self._get_step_time_names(max_steps)} {breakdown_clause} {inner_timestamps} {self._get_matching_events(max_steps)} {self._get_person_and_group_properties()} FROM (
{steps_per_person_query}
)
) WHERE steps = max_steps
GROUP BY aggregation_target, steps {breakdown_clause}
) GROUP BY aggregation_target, steps {breakdown_clause}
HAVING steps = max(max_steps)
"""

def get_step_counts_without_aggregation_query(self):
Expand Down
2 changes: 1 addition & 1 deletion posthog/queries/funnels/funnel_unordered.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def get_step_counts_query(self):
{union_query}
)
) GROUP BY aggregation_target, steps {breakdown_clause}
HAVING steps = max_steps
HAVING steps = max(max_steps)
"""

def get_step_counts_without_aggregation_query(self):
Expand Down

0 comments on commit 34370ca

Please sign in to comment.