diff --git a/posthog/hogql_queries/insights/insight_actors_query_runner.py b/posthog/hogql_queries/insights/insight_actors_query_runner.py index d58f36cb6f7ee..7d3b2a260845a 100644 --- a/posthog/hogql_queries/insights/insight_actors_query_runner.py +++ b/posthog/hogql_queries/insights/insight_actors_query_runner.py @@ -20,6 +20,7 @@ HogQLQueryResponse, StickinessQuery, TrendsQuery, + FunnelsQuery, ) from posthog.types import InsightActorsQueryNode @@ -84,6 +85,11 @@ def group_type_index(self) -> int | None: assert isinstance(self.query.source, FunnelCorrelationQuery) return self.query.source.source.source.aggregation_group_type_index + if isinstance(self.source_runner, FunnelsQueryRunner): + assert isinstance(self.query, FunnelsActorsQuery) + assert isinstance(self.query.source, FunnelsQuery) + return self.query.source.aggregation_group_type_index + if ( isinstance(self.source_runner, StickinessQueryRunner) and isinstance(self.query.source, StickinessQuery) ) or (isinstance(self.source_runner, TrendsQueryRunner) and isinstance(self.query.source, TrendsQuery)): diff --git a/posthog/hogql_queries/insights/test/test_insight_actors_query_runner.py b/posthog/hogql_queries/insights/test/test_insight_actors_query_runner.py index d24e4d6d8f2b7..1dad592a2449e 100644 --- a/posthog/hogql_queries/insights/test/test_insight_actors_query_runner.py +++ b/posthog/hogql_queries/insights/test/test_insight_actors_query_runner.py @@ -269,3 +269,32 @@ def test_insight_persons_funnels_query(self): ) self.assertEqual([("p1",), ("p2",)], response.results) + + def test_insight_groups_funnels_query(self): + self._create_test_groups() + self._create_test_events() + self.team.timezone = "US/Pacific" + self.team.save() + + response = self.select( + """ + select * from ( + + + } + series={[, ]} + /> + + + ) + """ + ) + + self.assertEqual( + [ + ("org1",), + ], + response.results, + )