Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(insights): show count in box plot detailed results (#121616)

Paul D'Ambraf5cfa36271f9
diff --git a/frontend/src/mocks/fixtures/api/projects/team_id/insights/trendsBoxPlot.json b/frontend/src/mocks/fixtures/api/projects/team_id/insights/trendsBoxPlot.json
index b3b3b91b5f93..99b710920e86 100644
--- a/frontend/src/mocks/fixtures/api/projects/team_id/insights/trendsBoxPlot.json
+++ b/frontend/src/mocks/fixtures/api/projects/team_id/insights/trendsBoxPlot.json
@@ -16,6 +16,7 @@
{
"day": "2022-03-05",
"label": "5-Mar-2022",
+ "count": 12,
"min": 12.5,
"p25": 45.0,
"median": 78.3,
@@ -26,6 +27,7 @@
{
"day": "2022-03-06",
"label": "6-Mar-2022",
+ "count": 9,
"min": 8.0,
"p25": 35.0,
"median": 62.0,
@@ -36,6 +38,7 @@
{
"day": "2022-03-07",
"label": "7-Mar-2022",
+ "count": 15,
"min": 20.0,
"p25": 55.0,
"median": 95.0,
@@ -46,6 +49,7 @@
{
"day": "2022-03-08",
"label": "8-Mar-2022",
+ "count": 11,
"min": 5.0,
"p25": 28.0,
"median": 50.0,
@@ -56,6 +60,7 @@
{
"day": "2022-03-09",
"label": "9-Mar-2022",
+ "count": 13,
"min": 15.0,
"p25": 42.0,
"median": 72.0,
@@ -66,6 +71,7 @@
{
"day": "2022-03-10",
"label": "10-Mar-2022",
+ "count": 18,
"min": 30.0,
"p25": 65.0,
"median": 105.0,
@@ -76,6 +82,7 @@
{
"day": "2022-03-11",
"label": "11-Mar-2022",
+ "count": 14,
"min": 18.0,
"p25": 50.0,
"median": 88.0,
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index 044649ebebb6..e853c5bb152c 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -6973,6 +6973,9 @@
"BoxPlotDatum": {
"additionalProperties": false,
"properties": {
+ "count": {
+ "$ref": "#/definitions/integer"
+ },
"day": {
"type": "string"
},
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index 997abcaaa7b0..a8226ad2b319 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -1989,6 +1989,7 @@ export const TRENDS_FILTER_PROPERTIES = new Set<keyof TrendsFilter>([
export interface BoxPlotDatum {
day: string
label: string
+ count?: integer
min: number
p25: number
median: number
diff --git a/posthog/schema.py b/posthog/schema.py
index e155fba4204a..3c9bd336c5e9 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -5279,6 +5279,7 @@ class BoxPlotDatum(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
+ count: int | None = None
day: str
label: str
max: float
diff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.ts
index 318ed813cc73..80a565b21322 100644
--- a/products/dashboards/frontend/generated/api.schemas.ts
+++ b/products/dashboards/frontend/generated/api.schemas.ts
@@ -2503,6 +2503,7 @@ export interface PropertyGroupFilterApi {
}
export interface BoxPlotDatumApi {
+ count?: number | null
day: string
label: string
max: number
diff --git a/products/desktop/packages/api-client/src/generated.ts b/products/desktop/packages/api-client/src/generated.ts
index bffda9d998ba..9fec9351d7e5 100644
--- a/products/desktop/packages/api-client/src/generated.ts
+++ b/products/desktop/packages/api-client/src/generated.ts
@@ -1954,6 +1954,7 @@ export namespace Schemas {
values: Array<PropertyGroupFilterValue>;
};
export type BoxPlotDatum = {
+ count?: (number | null) | undefined;
day: string;
label: string;
max: number;
diff --git a/products/persons/frontend/generated/api.schemas.ts b/products/persons/frontend/generated/api.schemas.ts
index aff144798b88..2b3864ddec4b 100644
--- a/products/persons/frontend/generated/api.schemas.ts
+++ b/products/persons/frontend/generated/api.schemas.ts
@@ -1594,6 +1594,7 @@ export interface PropertyGroupFilterApi {
}
export interface BoxPlotDatumApi {
+ count?: number | null
day: string
label: string
max: number
diff --git a/products/product_analytics/backend/hogql_queries/trends/boxplot_trends_query_runner.py b/products/product_analytics/backend/hogql_queries/trends/boxplot_trends_query_runner.py
index 7d39856ae69b..5b219678a51f 100644
--- a/products/product_analytics/backend/hogql_queries/trends/boxplot_trends_query_runner.py
+++ b/products/product_analytics/backend/hogql_queries/trends/boxplot_trends_query_runner.py
@@ -130,6 +130,7 @@ class BoxPlotTrendsQueryRunner(TrendsQueryRunner):
results_by_day[key] = BoxPlotDatum(
day=key,
label=format_label_date(day_val, self.query_date_range, self.team.week_start_day),
+ count=int(row[7]),
min=float(row[1]) if row[1] is not None else 0.0,
p25=float(row[2]) if row[2] is not None else 0.0,
median=float(row[3]) if row[3] is not None else 0.0,
@@ -149,6 +150,7 @@ class BoxPlotTrendsQueryRunner(TrendsQueryRunner):
BoxPlotDatum(
day=key,
label=format_label_date(dt, self.query_date_range, self.team.week_start_day),
+ count=0,
min=0.0,
p25=0.0,
median=0.0,
@@ -198,6 +200,7 @@ class BoxPlotTrendsQueryRunner(TrendsQueryRunner):
),
ast.Alias(alias="max_val", expr=ast.Call(name="max", args=[field_expr])),
ast.Alias(alias="mean_val", expr=ast.Call(name="avg", args=[field_expr])),
+ ast.Alias(alias="count_val", expr=ast.Call(name="count", args=[field_expr])),
]
def _build_standard_query(self, query_builder, agg_ops, series_node, events_filter, day_start) -> ast.SelectQuery:
diff --git a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_boxplot_trends_query_runner.ambr b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_boxplot_trends_query_runner.ambr
index ac04b06ff09f..b75e664084cf 100644
--- a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_boxplot_trends_query_runner.ambr
+++ b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_boxplot_trends_query_runner.ambr
@@ -7,7 +7,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'amount'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'amount'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'amount'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'amount'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'amount'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'amount'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), equals(e.event, 'purchase'))
GROUP BY day_start
@@ -34,7 +35,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -61,7 +63,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 10:00:00', 'UTC')), toIntervalHour(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 12:00:00', 'UTC'))))
GROUP BY day_start
@@ -88,7 +91,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 10:00:00', 'UTC')), toIntervalMinute(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 10:05:00', 'UTC'))))
GROUP BY day_start
@@ -115,7 +119,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-11-27 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-10 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -142,7 +147,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-10-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-31 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -169,7 +175,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-03 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -196,7 +203,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -223,7 +231,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), ifNull(notILike(toString(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.person_properties, 'email'), ''), 'null'), '^"|"$', '')), '%@posthog.com%'), 1))
GROUP BY day_start
@@ -250,7 +259,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-03 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -277,7 +287,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -304,7 +315,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'other_prop'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'other_prop'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'other_prop'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'other_prop'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'other_prop'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'other_prop'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), equals(e.event, 'other_event'))
GROUP BY day_start
@@ -331,7 +343,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -358,7 +371,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-08 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-10 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -385,7 +399,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -412,7 +427,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -439,7 +455,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Chrome'), 0))
GROUP BY day_start
@@ -466,7 +483,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), ifNull(equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, '$browser'), ''), 'null'), '^"|"$', ''), 'Firefox'), 0))
GROUP BY day_start
@@ -493,7 +511,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -520,7 +539,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-05 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -547,7 +567,8 @@
quantile(0.5)(accurateCastOrNull(session_duration, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(session_duration, 'Float64')) AS p75,
max(accurateCastOrNull(session_duration, 'Float64')) AS max_val,
- avg(accurateCastOrNull(session_duration, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(session_duration, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(session_duration, 'Float64')) AS count_val
FROM
(SELECT toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,
any(e__session.`$session_duration`) AS session_duration
@@ -585,7 +606,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-07 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -612,7 +634,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -639,7 +662,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -666,7 +690,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -693,7 +718,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -720,7 +746,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -747,7 +774,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -774,7 +802,8 @@
quantile(0.5)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS p75,
max(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS max_val,
- avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val
+ avg(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS mean_val,
+ count(accurateCastOrNull(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(e.properties, 'revenue'), ''), 'null'), '^"|"$', ''), 'Float64')) AS count_val
FROM events AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -801,7 +830,8 @@
quantile(0.5)(accurateCastOrNull(e.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.revenue, 'Float64')) AS count_val
FROM s3('http://host.docker.internal:19000/posthog/test_storage_bucket-posthog.hogql.datawarehouse.boxplot/posthog_test_boxplot_table/*.csv', 'object_storage_root_user', 'object_storage_root_password', 'CSVWithNames', '`id` String, `created` DateTime64(3, \'UTC\'), `revenue` Float64') AS e
WHERE and(greaterOrEquals(toTimeZone(e.created, 'UTC'), toStartOfInterval(assumeNotNull(toDateTime('2023-12-01 00:00:00', 'UTC')), toIntervalDay(1))), lessOrEquals(toTimeZone(e.created, 'UTC'), assumeNotNull(toDateTime('2023-12-03 23:59:59', 'UTC'))))
GROUP BY day_start
diff --git a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_boxplot_trends_query_runner.new_events_schema.ambr b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_boxplot_trends_query_runner.new_events_schema.ambr
index 474948bd87bd..dd1d3afc91b9 100644
--- a/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_boxplot_trends_query_runner.new_events_schema.ambr
+++ b/products/product_analytics/backend/hogql_queries/trends/test/__snapshots__/test_boxplot_trends_query_runner.new_events_schema.ambr
@@ -7,7 +7,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.amount, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.amount, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.amount, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.amount, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.amount, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.amount, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), equals(e.event, 'purchase'))
GROUP BY day_start
@@ -36,7 +37,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -65,7 +67,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 10:00:00', 'UTC')), toIntervalHour(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 12:00:00', 'UTC'))))
GROUP BY day_start
@@ -94,7 +97,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 10:00:00', 'UTC')), toIntervalMinute(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 10:05:00', 'UTC'))))
GROUP BY day_start
@@ -123,7 +127,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-11-27 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-10 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -152,7 +157,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-10-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-31 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -181,7 +187,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-03 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -210,7 +217,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -239,7 +247,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), ifNull(notILike(toString(if(notEquals(toJSONString(e.person_properties.^email), '{}'), toJSONString(e.person_properties.^email), if(isNull(nullIf(toString(e.person_properties.email), '')), NULL, if(and(in(ascii(toString(e.person_properties.email)), tuple(91, 123)), in(ascii(toJSONString(e.person_properties.email)), tuple(91, 123))), nullIf(nullIf(toJSONString(e.person_properties.email), '[]'), '{}'), toString(e.person_properties.email))))), '%@posthog.com%'), 1))
GROUP BY day_start
@@ -268,7 +277,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-03 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -297,7 +307,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.other_prop, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.other_prop, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.other_prop, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.other_prop, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.other_prop, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.other_prop, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), equals(e.event, 'other_event'))
GROUP BY day_start
@@ -326,7 +337,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -355,7 +367,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -384,7 +397,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-08 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-10 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -413,7 +427,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -442,7 +457,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -471,7 +487,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), equals(e.properties.`$browser`, 'Chrome'))
GROUP BY day_start
@@ -500,7 +517,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))), equals(e.properties.`$browser`, 'Firefox'))
GROUP BY day_start
@@ -529,7 +547,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -558,7 +577,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-05 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -587,7 +607,8 @@
quantile(0.5)(accurateCastOrNull(session_duration, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(session_duration, 'Float64')) AS p75,
max(accurateCastOrNull(session_duration, 'Float64')) AS max_val,
- avg(accurateCastOrNull(session_duration, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(session_duration, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(session_duration, 'Float64')) AS count_val
FROM
(SELECT toStartOfDay(toTimeZone(e.timestamp, 'UTC')) AS day_start,
any(e__session.`$session_duration`) AS session_duration
@@ -627,7 +648,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-01 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-07 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -656,7 +678,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -685,7 +708,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -714,7 +738,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -743,7 +768,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -772,7 +798,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -801,7 +828,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
@@ -830,7 +858,8 @@
quantile(0.5)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS median_val,
quantile(0.75)(accurateCastOrNull(e.properties.revenue, 'Float64')) AS p75,
max(accurateCastOrNull(e.properties.revenue, 'Float64')) AS max_val,
- avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val
+ avg(accurateCastOrNull(e.properties.revenue, 'Float64')) AS mean_val,
+ count(accurateCastOrNull(e.properties.revenue, 'Float64')) AS count_val
FROM events_json AS e
WHERE and(equals(e.team_id, 99999), greaterOrEquals(e.timestamp, toDateTime64(toStartOfInterval(assumeNotNull(toDateTime('2023-12-02 00:00:00', 'UTC')), toIntervalDay(1)), 6, 'UTC')), lessOrEquals(e.timestamp, assumeNotNull(toDateTime('2023-12-02 23:59:59', 'UTC'))))
GROUP BY day_start
diff --git a/products/product_analytics/backend/hogql_queries/trends/test/test_boxplot_trends_query_runner.py b/products/product_analytics/backend/hogql_queries/trends/test/test_boxplot_trends_query_runner.py
index 51c033580d88..b88bd89e6f26 100644
--- a/products/product_analytics/backend/hogql_queries/trends/test/test_boxplot_trends_query_runner.py
+++ b/products/product_analytics/backend/hogql_queries/trends/test/test_boxplot_trends_query_runner.py
@@ -87,6 +87,7 @@ class TestBoxPlotTrendsQueryRunner(ClickhouseTestMixin, APIBaseTest):
assert len(data) == 3
for datum in data:
+ assert datum.count == 0
assert datum.min == 0.0
assert datum.max == 0.0
assert datum.mean == 0.0
@@ -162,6 +163,7 @@ class TestBoxPlotTrendsQueryRunner(ClickhouseTestMixin, APIBaseTest):
datum = data[0]
assert datum.min == expected_min
+ assert datum.count == len(values)
assert datum.max == expected_max
assert datum.mean == pytest.approx(expected_mean, abs=0.01)
assert datum.min <= datum.p25 <= datum.median <= datum.p75 <= datum.max
@@ -254,6 +256,7 @@ class TestBoxPlotTrendsQueryRunner(ClickhouseTestMixin, APIBaseTest):
for zero_day in ["2023-12-02", "2023-12-03", "2023-12-04", "2023-12-06", "2023-12-07"]:
datum = days_with_data[zero_day]
+ assert datum.count == 0
assert datum.min == 0.0
assert datum.max == 0.0
assert datum.mean == 0.0
@@ -418,6 +421,7 @@ class TestBoxPlotTrendsQueryRunner(ClickhouseTestMixin, APIBaseTest):
assert datum.median == 0.0
assert datum.p25 == 0.0
assert datum.p75 == 0.0
+ assert datum.count == 0
@snapshot_clickhouse_queries
def test_results_are_ordered_by_day_ascending(self):
@@ -525,6 +529,7 @@ class TestBoxPlotTrendsQueryRunner(ClickhouseTestMixin, APIBaseTest):
assert len(data) == 1
datum = data[0]
assert datum.day == "2023-12-02"
+ assert datum.count == 2
assert datum.min > 0
assert datum.max > 0
assert datum.min <= datum.p25 <= datum.median <= datum.p75 <= datum.max
@@ -579,6 +584,7 @@ class TestBoxPlotTrendsQueryRunnerDataWarehouse(ClickhouseTestMixin, APIBaseTest
by_day = {d.day: d for d in data}
datum = by_day["2023-12-02"]
+ assert datum.count == 5
assert datum.min == 10.0
assert datum.p25 == pytest.approx(20.0)
assert datum.median == pytest.approx(30.0)
@@ -588,6 +594,7 @@ class TestBoxPlotTrendsQueryRunnerDataWarehouse(ClickhouseTestMixin, APIBaseTest
assert datum.series_label == f"{table.name} - revenue"
for zero_day in ["2023-12-01", "2023-12-03"]:
+ assert by_day[zero_day].count == 0
assert by_day[zero_day].min == 0.0
assert by_day[zero_day].max == 0.0
diff --git a/products/product_analytics/frontend/generated/api.schemas.ts b/products/product_analytics/frontend/generated/api.schemas.ts
index 2495033fd9e5..6c2c41fa6559 100644
--- a/products/product_analytics/frontend/generated/api.schemas.ts
+++ b/products/product_analytics/frontend/generated/api.schemas.ts
@@ -1329,6 +1329,7 @@ export interface PropertyGroupFilterApi {
}
export interface BoxPlotDatumApi {
+ count?: number | null
day: string
label: string
max: number
diff --git a/products/product_analytics/frontend/insights/trends/BoxPlot/BoxPlotResultsTable.tsx b/products/product_analytics/frontend/insights/trends/BoxPlot/BoxPlotResultsTable.tsx
index 86a89a577682..958828f526b0 100644
--- a/products/product_analytics/frontend/insights/trends/BoxPlot/BoxPlotResultsTable.tsx
+++ b/products/product_analytics/frontend/insights/trends/BoxPlot/BoxPlotResultsTable.tsx
@@ -48,6 +48,12 @@ export function BoxPlotResultsTable(): JSX.Element | null {
key: 'label',
render: (_, datum: BoxPlotDatum) => datum.label,
},
+ {
+ title: 'Count',
+ key: 'count',
+ align: 'right',
+ render: (_, datum: BoxPlotDatum) => datum.count?.toLocaleString() ?? '-',
+ },
{
title: 'Min',
key: 'min',
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 507fa1732ce9..cde3bd4b47ef 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -5733,6 +5733,7 @@ export namespace Schemas {
}
export interface BoxPlotDatum {
+ count?: number | null;
day: string;
label: string;
max: number;