From cb12ce03c2c0b1d774c505dd3cfa8292a08966a0 Mon Sep 17 00:00:00 2001 From: Juraj Majerik Date: Thu, 1 Feb 2024 15:55:00 +0100 Subject: [PATCH] fix(trend experiments): filter insight results correctly (#20080) --- ee/clickhouse/queries/experiments/trend_experiment_result.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ee/clickhouse/queries/experiments/trend_experiment_result.py b/ee/clickhouse/queries/experiments/trend_experiment_result.py index 1cac73b3d6b85..da69b2cc36a94 100644 --- a/ee/clickhouse/queries/experiments/trend_experiment_result.py +++ b/ee/clickhouse/queries/experiments/trend_experiment_result.py @@ -236,6 +236,10 @@ def get_variants(self, insight_results, exposure_results): exposure_counts = {} exposure_ratios = {} + # :TRICKY: With count per user aggregation, our exposure filter is implicit: + # (1) We calculate the unique users for this event -> this is the exposure + # (2) We calculate the total count of this event -> this is the trend goal metric / arrival rate for probability calculation + # TODO: When we support group aggregation per user, change this. if uses_math_aggregation_by_user_or_property_value(self.query_filter): filtered_exposure_results = [ result for result in exposure_results if result["action"]["math"] == UNIQUE_USERS