PostHog / posthog

🦔 PostHog provides open-source web & product analytics, session recording, feature flagging and A/B testing that you can self-host. Get started - free.
https://posthog.com
Other
22.05k stars 1.33k forks source link

Support placeholders in HogQL expressions within insights #25983

Open thmsobrmlr opened 2 weeks ago

thmsobrmlr commented 2 weeks ago

Feature request

Is your feature request related to a problem?

Users would like to add subqueries to their insight conditions that need to respect the insight's {filters} e.g. for have a subcondition that is based on a dashboard's date range.

Describe the solution you'd like

Add support for placeholders in HogQL expressions the same way they work in the SQL tab.

Describe alternatives you've considered

Maybe something smart could be done with cohorts or automatically adding filters to all subqueries in HogQL expressions.

Additional context

Debug info

No response

mariusandra commented 2 weeks ago

Somewhat relevant, I have here two draft PRs to improve placeholders by making them support Hog code and conditional SQL chunks:

ianlyons commented 1 week ago

+1! this would be really useful! my immediate use case is created a "single customer dashboard" and allowing the team to filter by customer to see the same metrics applied to different customers