Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(trends): convert event to local timezone for active user adjusted dates #17285

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@
(SELECT toStartOfDay(toTimeZone(toDateTime(timestamp, 'UTC'), 'UTC')) AS timestamp
FROM events e
WHERE team_id = 2
AND toDateTime(timestamp, 'UTC') >= toDateTime('2011-12-25 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2011-12-25 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2012-01-15 23:59:59', 'UTC')
GROUP BY timestamp) d
CROSS JOIN
Expand Down Expand Up @@ -592,7 +592,7 @@
AND (has(['some_val'], replaceRegexpAll(JSONExtractRaw(argMax(person.properties, version), 'key'), '^"|"$', ''))))) person ON person.id = pdi.person_id
WHERE e.team_id = 2
AND event = '$pageview'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2011-12-25 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2011-12-25 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2012-01-15 23:59:59', 'UTC')
GROUP BY timestamp, person_id,
breakdown_value) e
Expand Down Expand Up @@ -647,7 +647,7 @@
AND (has(['some_val'], replaceRegexpAll(JSONExtractRaw(argMax(person.properties, version), 'key'), '^"|"$', ''))))) person ON person.id = pdi.person_id
WHERE team_id = 2
AND event = '$pageview'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2011-12-25 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2011-12-25 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2012-01-14 23:59:59', 'UTC')
AND (((has(['val'], replaceRegexpAll(JSONExtractRaw(e.properties, 'key'), '^"|"$', ''))))) )
GROUP BY actor_id
Expand Down
60 changes: 30 additions & 30 deletions posthog/queries/test/__snapshots__/test_trends.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -483,9 +483,9 @@
HAVING argMax(is_deleted, version) = 0) as pdi ON events.distinct_id = pdi.distinct_id
WHERE e.team_id = 2
AND event = '$pageview'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2020-01-04 23:59:59', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-04 23:59:59', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-11 23:59:59', 'UTC')
AND toDateTime(timestamp, 'UTC') >= toDateTime('2020-01-04 23:59:59', 'UTC') - INTERVAL 6 DAY
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-04 23:59:59', 'UTC') - INTERVAL 6 DAY
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-11 23:59:59', 'UTC')
GROUP BY breakdown_value
ORDER BY breakdown_value
Expand Down Expand Up @@ -531,9 +531,9 @@
HAVING argMax(is_deleted, version) = 0) as pdi ON events.distinct_id = pdi.distinct_id
WHERE e.team_id = 2
AND event = '$pageview'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2020-01-04 23:59:59', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-04 23:59:59', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-11 23:59:59', 'UTC')
AND toDateTime(timestamp, 'UTC') >= toDateTime('2020-01-04 23:59:59', 'UTC') - INTERVAL 6 DAY
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-04 23:59:59', 'UTC') - INTERVAL 6 DAY
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-11 23:59:59', 'UTC')
GROUP BY breakdown_value
ORDER BY breakdown_value
Expand Down Expand Up @@ -622,7 +622,7 @@
(SELECT toStartOfDay(toTimeZone(toDateTime(timestamp, 'UTC'), 'UTC')) AS timestamp
FROM events e
WHERE team_id = 2
AND toDateTime(timestamp, 'UTC') >= toDateTime('2019-12-25 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2019-12-25 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-12 23:59:59', 'UTC')
GROUP BY timestamp) d
CROSS JOIN
Expand All @@ -645,7 +645,7 @@
GROUP BY id
HAVING max(is_deleted) = 0) person ON person.id = pdi.person_id
WHERE e.team_id = 2
AND toDateTime(timestamp, 'UTC') >= toDateTime('2019-12-25 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2019-12-25 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-12 23:59:59', 'UTC')
AND ((event = '$pageview'
AND (has(['p1', 'p2', 'p3'], replaceRegexpAll(JSONExtractRaw(person_props, 'name'), '^"|"$', ''))
Expand Down Expand Up @@ -1317,7 +1317,7 @@
(SELECT toStartOfDay(toTimeZone(toDateTime(timestamp, 'UTC'), 'UTC')) AS timestamp
FROM events e
WHERE team_id = 2
AND toDateTime(timestamp, 'UTC') >= toDateTime('2019-11-28 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2019-11-28 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-04 23:59:59', 'UTC')
GROUP BY timestamp) d
CROSS JOIN
Expand Down Expand Up @@ -1347,7 +1347,7 @@
AND (has(['filter_val'], replaceRegexpAll(JSONExtractRaw(argMax(person.properties, version), 'filter_prop'), '^"|"$', '')))) person ON person.id = pdi.person_id
WHERE e.team_id = 2
AND event = 'sign up'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2019-11-28 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2019-11-28 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-04 23:59:59', 'UTC')
GROUP BY timestamp, person_id,
breakdown_value) e
Expand Down Expand Up @@ -1431,7 +1431,7 @@
(SELECT toStartOfDay(toTimeZone(toDateTime(timestamp, 'UTC'), 'UTC')) AS timestamp
FROM events e
WHERE team_id = 2
AND toDateTime(timestamp, 'UTC') >= toDateTime('2019-11-28 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2019-11-28 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-04 23:59:59', 'UTC')
GROUP BY timestamp) d
CROSS JOIN
Expand All @@ -1448,7 +1448,7 @@
WHERE e.team_id = 2
AND event = 'sign up'
AND (has(['filter_val'], replaceRegexpAll(JSONExtractRaw(e.person_properties, 'filter_prop'), '^"|"$', '')))
AND toDateTime(timestamp, 'UTC') >= toDateTime('2019-11-28 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2019-11-28 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-04 23:59:59', 'UTC')
AND notEmpty(e.person_id)
AND notEmpty(e.person_id)
Expand Down Expand Up @@ -2244,7 +2244,7 @@
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
AND event = 'sign up'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2019-12-22 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2019-12-22 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-05 23:59:59', 'UTC')
GROUP BY timestamp, actor_id) e
WHERE e.timestamp <= d.timestamp + INTERVAL 1 DAY
Expand Down Expand Up @@ -2449,7 +2449,7 @@
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
AND event = 'sign up'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2019-12-22 00:00:00', 'America/Phoenix')
AND toTimeZone(timestamp, 'America/Phoenix') >= toDateTime('2019-12-22 00:00:00', 'America/Phoenix')
AND toTimeZone(timestamp, 'America/Phoenix') <= toDateTime('2020-01-05 23:59:59', 'America/Phoenix')
GROUP BY timestamp, actor_id) e
WHERE e.timestamp <= d.timestamp + INTERVAL 1 DAY
Expand Down Expand Up @@ -2654,7 +2654,7 @@
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
AND event = 'sign up'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2019-12-22 00:00:00', 'Asia/Tokyo')
AND toTimeZone(timestamp, 'Asia/Tokyo') >= toDateTime('2019-12-22 00:00:00', 'Asia/Tokyo')
AND toTimeZone(timestamp, 'Asia/Tokyo') <= toDateTime('2020-01-05 23:59:59', 'Asia/Tokyo')
GROUP BY timestamp, actor_id) e
WHERE e.timestamp <= d.timestamp + INTERVAL 1 DAY
Expand Down Expand Up @@ -3726,7 +3726,7 @@
FROM events e
WHERE team_id = 2
AND event = 'sign up'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2019-11-24 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2019-11-24 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2019-12-31 23:59:59', 'UTC')
GROUP BY timestamp, actor_id) e
WHERE e.timestamp <= d.timestamp + INTERVAL 1 DAY
Expand Down Expand Up @@ -3768,7 +3768,7 @@
FROM events e
WHERE team_id = 2
AND event = 'sign up'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2019-12-17 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2019-12-17 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2019-12-31 23:59:59', 'UTC')
GROUP BY timestamp, actor_id) e
WHERE e.timestamp <= d.timestamp + INTERVAL 1 DAY
Expand Down Expand Up @@ -4994,7 +4994,7 @@
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
AND event = '$pageview'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2020-01-05 23:59:59', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-05 23:59:59', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-12 23:59:59', 'UTC')
'
---
Expand All @@ -5012,7 +5012,7 @@
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
AND event = '$pageview'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2020-01-01 23:59:59', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 23:59:59', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
'
---
Expand All @@ -5030,7 +5030,7 @@
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
AND event = '$pageview'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2020-01-01 23:59:59', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 23:59:59', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-08 23:59:59', 'UTC')
'
---
Expand Down Expand Up @@ -5069,7 +5069,7 @@
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
AND event = '$pageview'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-19 23:59:59', 'UTC')
GROUP BY timestamp, actor_id) e
WHERE e.timestamp <= d.timestamp + INTERVAL 1 DAY
Expand Down Expand Up @@ -5118,7 +5118,7 @@
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
AND event = '$pageview'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'America/Phoenix')
AND toTimeZone(timestamp, 'America/Phoenix') >= toDateTime('2020-01-01 00:00:00', 'America/Phoenix')
AND toTimeZone(timestamp, 'America/Phoenix') <= toDateTime('2020-01-19 23:59:59', 'America/Phoenix')
GROUP BY timestamp, actor_id) e
WHERE e.timestamp <= d.timestamp + INTERVAL 1 DAY
Expand Down Expand Up @@ -5167,7 +5167,7 @@
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
AND event = '$pageview'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2020-01-01 00:00:00', 'Asia/Tokyo')
AND toTimeZone(timestamp, 'Asia/Tokyo') >= toDateTime('2020-01-01 00:00:00', 'Asia/Tokyo')
AND toTimeZone(timestamp, 'Asia/Tokyo') <= toDateTime('2020-01-19 23:59:59', 'Asia/Tokyo')
GROUP BY timestamp, actor_id) e
WHERE e.timestamp <= d.timestamp + INTERVAL 1 DAY
Expand Down Expand Up @@ -5228,7 +5228,7 @@
AND (has(['person-1', 'person-2'], replaceRegexpAll(JSONExtractRaw(argMax(person.properties, version), 'name'), '^"|"$', '')))) person ON person.id = pdi.person_id
WHERE team_id = 2
AND event = '$pageview'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2019-12-25 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2019-12-25 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-12 23:59:59', 'UTC')
GROUP BY timestamp, actor_id) e
WHERE e.timestamp <= d.timestamp + INTERVAL 1 DAY
Expand Down Expand Up @@ -5289,7 +5289,7 @@
AND (has(['person-1', 'person-2'], argMax(person."pmat_name", version)))) person ON person.id = pdi.person_id
WHERE team_id = 2
AND event = '$pageview'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2019-12-25 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2019-12-25 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-12 23:59:59', 'UTC')
GROUP BY timestamp, actor_id) e
WHERE e.timestamp <= d.timestamp + INTERVAL 1 DAY
Expand Down Expand Up @@ -5338,7 +5338,7 @@
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
AND event = '$pageview'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2020-01-02 06:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2020-01-02 06:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-09 17:00:00', 'UTC')
GROUP BY timestamp, actor_id) e
WHERE e.timestamp <= d.timestamp + INTERVAL 1 DAY
Expand Down Expand Up @@ -5387,7 +5387,7 @@
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
AND event = '$pageview'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2019-11-24 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2019-11-24 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-02-29 23:59:59', 'UTC')
GROUP BY timestamp, actor_id) e
WHERE e.timestamp <= d.timestamp + INTERVAL 1 DAY
Expand Down Expand Up @@ -5436,7 +5436,7 @@
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
AND event = '$pageview'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2019-11-24 00:00:00', 'America/Phoenix')
AND toTimeZone(timestamp, 'America/Phoenix') >= toDateTime('2019-11-24 00:00:00', 'America/Phoenix')
AND toTimeZone(timestamp, 'America/Phoenix') <= toDateTime('2020-02-29 23:59:59', 'America/Phoenix')
GROUP BY timestamp, actor_id) e
WHERE e.timestamp <= d.timestamp + INTERVAL 1 DAY
Expand Down Expand Up @@ -5485,7 +5485,7 @@
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
AND event = '$pageview'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2019-11-24 00:00:00', 'Asia/Tokyo')
AND toTimeZone(timestamp, 'Asia/Tokyo') >= toDateTime('2019-11-24 00:00:00', 'Asia/Tokyo')
AND toTimeZone(timestamp, 'Asia/Tokyo') <= toDateTime('2020-02-29 23:59:59', 'Asia/Tokyo')
GROUP BY timestamp, actor_id) e
WHERE e.timestamp <= d.timestamp + INTERVAL 1 DAY
Expand Down Expand Up @@ -5534,7 +5534,7 @@
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
AND event = '$pageview'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2019-12-22 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') >= toDateTime('2019-12-22 00:00:00', 'UTC')
AND toTimeZone(timestamp, 'UTC') <= toDateTime('2020-01-18 23:59:59', 'UTC')
GROUP BY timestamp, actor_id) e
WHERE e.timestamp <= d.timestamp + INTERVAL 1 DAY
Expand Down Expand Up @@ -5583,7 +5583,7 @@
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
AND event = '$pageview'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2019-12-22 00:00:00', 'America/Phoenix')
AND toTimeZone(timestamp, 'America/Phoenix') >= toDateTime('2019-12-22 00:00:00', 'America/Phoenix')
AND toTimeZone(timestamp, 'America/Phoenix') <= toDateTime('2020-01-18 23:59:59', 'America/Phoenix')
GROUP BY timestamp, actor_id) e
WHERE e.timestamp <= d.timestamp + INTERVAL 1 DAY
Expand Down Expand Up @@ -5632,7 +5632,7 @@
HAVING argMax(is_deleted, version) = 0) AS pdi ON e.distinct_id = pdi.distinct_id
WHERE team_id = 2
AND event = '$pageview'
AND toDateTime(timestamp, 'UTC') >= toDateTime('2019-12-22 00:00:00', 'Asia/Tokyo')
AND toTimeZone(timestamp, 'Asia/Tokyo') >= toDateTime('2019-12-22 00:00:00', 'Asia/Tokyo')
AND toTimeZone(timestamp, 'Asia/Tokyo') <= toDateTime('2020-01-18 23:59:59', 'Asia/Tokyo')
GROUP BY timestamp, actor_id) e
WHERE e.timestamp <= d.timestamp + INTERVAL 1 DAY
Expand Down
6 changes: 3 additions & 3 deletions posthog/queries/trends/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
SELECT counts AS total, timestamp AS day_start, breakdown_value
FROM (
SELECT d.timestamp, COUNT(DISTINCT person_id) counts, breakdown_value FROM (
SELECT toStartOfDay(toTimeZone(toDateTime(timestamp, 'UTC'), %(timezone)s)) AS timestamp FROM events e WHERE team_id = %(team_id)s {parsed_date_from_prev_range} {parsed_date_to} GROUP BY timestamp
SELECT toStartOfDay(toTimeZone(toDateTime(timestamp, 'UTC'), %(timezone)s)) AS timestamp FROM events e WHERE team_id = %(team_id)s {parsed_date_from_active_user_adjusted} {parsed_date_to} GROUP BY timestamp
) d
CROSS JOIN (
SELECT
Expand Down Expand Up @@ -332,7 +332,7 @@
{sessions_join}
{conditions}
{null_person_filter}
{parsed_date_from_prev_range} - INTERVAL {prev_interval} {parsed_date_to}
{parsed_date_from_active_user_adjusted} - INTERVAL {prev_interval} {parsed_date_to}
GROUP BY breakdown_value
ORDER BY breakdown_value
"""
Expand Down Expand Up @@ -369,7 +369,7 @@
"""

BREAKDOWN_ACTIVE_USER_CONDITIONS_SQL = """
WHERE e.team_id = %(team_id)s {event_filter} {filters} {parsed_date_from_prev_range} {parsed_date_to} {actions_query} {null_person_filter}
WHERE e.team_id = %(team_id)s {event_filter} {filters} {parsed_date_from_active_user_adjusted} {parsed_date_to} {actions_query} {null_person_filter}
"""

BREAKDOWN_PROP_JOIN_SQL = """
Expand Down
2 changes: 1 addition & 1 deletion posthog/queries/trends/trends_event_query_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def _get_date_filter(self) -> Tuple[str, Dict]:
self.active_user_params = active_user_format_params
query_params.update(active_user_query_params)

date_filter = "{parsed_date_from_prev_range} {parsed_date_to}".format(
date_filter = "{parsed_date_from_active_user_adjusted} {parsed_date_to}".format(
**active_user_format_params, parsed_date_to=parsed_date_to
)
else:
Expand Down
Loading