Bruno
02-25-2025Cloud Apps
Filter on first events in period
I have a requirement to filter a fact table by the first event for each user in a period.
e.g with user A B and C
1: user A - 02 jan 2024
2: user B - 04 jan 2024
3: user A - 05 jan 2024
...
- 03-05-2025
Hi David,
It's possible that Assaf's multi-pass solution might work. However we have internally decided that the generated SQL would be too costly to run on a dashboard refresh so we refactored our solution.
Instead of ranking the events to identify the first in the requested period, we have pre-computed the "previous event date" at DB level and changed our filters to check that the "previous date" is before the requested period's "From date".
It is functionally equivalent and cheaper to compute at refresh time.