posthog icon indicating copy to clipboard operation
posthog copied to clipboard

Bug: When filtering by all time on a Data Warehouse table the startdate is set to the first event in the events table

Open darkopia opened this issue 7 months ago • 0 comments

Bug Description

Bug description

Please describe. https://github.com/PostHog/posthog/blob/006255c5a7e2bb02d24a3462e6097f3ab9f5c65a/posthog/queries/util.py#L4 based on what I am reading here to get the first event for an "All events" query we get the first event from the events table, this is problematic when we are looking at data warehouse tables which might have data with timestamps before the first event.

If you are on PostHog Cloud it would be really valuable if you can share any links where the problem occurs. This speeds up our ability to troubleshoot tremendously.

How to reproduce

  1. Import historic data into data warehouse tables
  2. Set "All time" filter against a data warehouse table
  3. Use "last 10 years filter
  4. If there are timestamps in the data warehouse table from before the first event was captured in the events table, the all filter will show fewer events than last 10 years filter.

Additional context

From: https://posthoghelp.zendesk.com/agent/tickets/32463

Debug info

Kind: bug

Target area: analytics

Report event: http://go/ticketByUUID/998de076-ff98-4080-a7f8-b92ef8a54ec5

Session: https://us.posthog.com/project/sTMFPsFhdP1Ssg/replay/0197646a-8380-717f-bcc0-859881b83df3?t=260

Exceptions: https://us.posthog.com/project/2/error_tracking?filterGroup=%7B%22type%22%3A%22AND%22%2C%22values%22%3A%5B%7B%22type%22%3A%22AND%22%2C%22values%22%3A%5B%7B%22key%22%3A%22%24session_id%22%2C%22value%22%3A%5B%220197646a-8380-717f-bcc0-859881b83df3%22%5D%2C%22operator%22%3A%22exact%22%2C%22type%22%3A%22event%22%7D%5D%7D%5D%7D

Location: https://us.posthog.com/project/103405/pipeline/sources/managed-01961b10-d956-0000-bf76-93529a719180/schemas

Persons-on-events mode for project: person_id_override_properties_on_events

darkopia avatar Jun 13 '25 22:06 darkopia