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(bi): add optional pane settings to worksheet schema (#117943)

Marius Andra502c7f96576f
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index 1b4b3dd8cdb2..cba0ec296bd9 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -6293,6 +6293,10 @@
"enum": ["gap", "zero"],
"type": "string"
},
+ "panes": {
+ "$ref": "#/definitions/BIPaneSettings",
+ "description": "Split the returned groups into charts using these ordered dimension IDs."
+ },
"resultFilterGroup": {
"$ref": "#/definitions/BIConditionGroup"
},
@@ -6541,6 +6545,29 @@
}
]
},
+ "BIPaneSettings": {
+ "additionalProperties": false,
+ "properties": {
+ "fields": {
+ "description": "Ordered dimension IDs used to split returned groups into separate charts.",
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "independentAxes": {
+ "description": "Use a separate value scale for each pane instead of a shared primary scale.",
+ "type": "boolean"
+ },
+ "referenceLines": {
+ "description": "Calculate reference lines from each pane or from all returned worksheet marks.",
+ "enum": ["pane", "worksheet"],
+ "type": "string"
+ }
+ },
+ "required": ["fields"],
+ "type": "object"
+ },
"BIQueryLimit": {
"enum": [100, 1000, 10000, 50000],
"type": "number"
diff --git a/frontend/src/queries/schema/schema-business-intelligence.ts b/frontend/src/queries/schema/schema-business-intelligence.ts
index 576247f086de..adcb5bbba1f6 100644
--- a/frontend/src/queries/schema/schema-business-intelligence.ts
+++ b/frontend/src/queries/schema/schema-business-intelligence.ts
@@ -139,6 +139,15 @@ export interface BIFilter {
enabled?: boolean
}
+export interface BIPaneSettings {
+ /** Ordered dimension IDs used to split returned groups into separate charts. */
+ fields: string[]
+ /** Use a separate value scale for each pane instead of a shared primary scale. */
+ independentAxes?: boolean
+ /** Calculate reference lines from each pane or from all returned worksheet marks. */
+ referenceLines?: 'pane' | 'worksheet'
+}
+
export interface BIConfig {
source: BIDataSource | null
/** Reusable expressions owned by this worksheet only. */
@@ -153,6 +162,8 @@ export interface BIConfig {
}[]
memberAliases?: { field: BIField; aliases: { value: string | null; label: string }[] }[]
colorBy?: string | null
+ /** Split the returned groups into charts using these ordered dimension IDs. */
+ panes?: BIPaneSettings
/** Column that receives the worksheet and dashboard date range. */
dateField?: BIField | null
dateRange?: DateRange
diff --git a/posthog/schema.py b/posthog/schema.py
index 6004794d690a..4f003ab1830a 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -270,6 +270,7 @@ from posthog.schema_enums import (
RecordingOrder as RecordingOrder,
RecordingOrderDirection as RecordingOrderDirection,
RedditAdsDefaultSources as RedditAdsDefaultSources,
+ ReferenceLines as ReferenceLines,
RefreshType as RefreshType,
ResultCustomizationBy as ResultCustomizationBy,
RetentionDashboardDisplayType as RetentionDashboardDisplayType,
@@ -1027,6 +1028,24 @@ class BILocalFieldDefinition3(BaseModel):
width: float
+class BIPaneSettings(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ fields: list[str] = Field(
+ ...,
+ description=("Ordered dimension IDs used to split returned groups into separate charts."),
+ )
+ independentAxes: bool | None = Field(
+ default=None,
+ description=("Use a separate value scale for each pane instead of a shared primary scale."),
+ )
+ referenceLines: ReferenceLines | None = Field(
+ default=None,
+ description=("Calculate reference lines from each pane or from all returned worksheet marks."),
+ )
+
+
class BITotals(BaseModel):
model_config = ConfigDict(
extra="forbid",
@@ -11476,6 +11495,10 @@ class BIConfig(BaseModel):
default=None,
description=("Fill missing date buckets before table calculations. Unset preserves observed points only."),
)
+ panes: BIPaneSettings | None = Field(
+ default=None,
+ description=("Split the returned groups into charts using these ordered dimension IDs."),
+ )
resultFilterGroup: BIConditionGroup | None = None
resultFilters: list[BIResultFilter] | None = None
rowFilterGroup: BIConditionGroup | None = None
diff --git a/posthog/schema_enums.py b/posthog/schema_enums.py
index d102e6ecc13e..d4e0a5532ae0 100644
--- a/posthog/schema_enums.py
+++ b/posthog/schema_enums.py
@@ -696,6 +696,11 @@ class BIFilterOperator(StrEnum):
CUSTOM = "custom"
+class ReferenceLines(StrEnum):
+ PANE = "pane"
+ WORKSHEET = "worksheet"
+
+
class BIQueryLimit(float, Enum):
NUMBER_100 = 100
NUMBER_1000 = 1000
diff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.ts
index 675abd2fb4ea..08253d2ae65d 100644
--- a/products/dashboards/frontend/generated/api.schemas.ts
+++ b/products/dashboards/frontend/generated/api.schemas.ts
@@ -9618,6 +9618,22 @@ export const MissingDatesApi = {
Zero: 'zero',
} as const
+export type ReferenceLinesApi = (typeof ReferenceLinesApi)[keyof typeof ReferenceLinesApi]
+
+export const ReferenceLinesApi = {
+ Pane: 'pane',
+ Worksheet: 'worksheet',
+} as const
+
+export interface BIPaneSettingsApi {
+ /** Ordered dimension IDs used to split returned groups into separate charts. */
+ fields: string[]
+ /** Use a separate value scale for each pane instead of a shared primary scale. */
+ independentAxes?: boolean | null
+ /** Calculate reference lines from each pane or from all returned worksheet marks. */
+ referenceLines?: ReferenceLinesApi | null
+}
+
export type Operator1Api = (typeof Operator1Api)[keyof typeof Operator1Api]
export const Operator1Api = {
@@ -9755,6 +9771,8 @@ export interface BIConfigApi {
memberAliases?: MemberAliaseApi[] | null
/** Fill missing date buckets before table calculations. Unset preserves observed points only. */
missingDates?: MissingDatesApi | null
+ /** Split the returned groups into charts using these ordered dimension IDs. */
+ panes?: BIPaneSettingsApi | null
resultFilterGroup?: BIConditionGroupApi | null
resultFilters?: BIResultFilterApi[] | null
rowFilterGroup?: BIConditionGroupApi | null
diff --git a/products/desktop/packages/api-client/src/generated.ts b/products/desktop/packages/api-client/src/generated.ts
index f295a326e180..d21c4c432f22 100644
--- a/products/desktop/packages/api-client/src/generated.ts
+++ b/products/desktop/packages/api-client/src/generated.ts
@@ -4711,6 +4711,15 @@ export namespace Schemas {
export type BIQueryLimit = 100 | 1000 | 10000 | 50000;
export type MemberAliase = { aliases: Array<Alias>; field: BIField };
export type MissingDates = "gap" | "zero";
+ export type ReferenceLines = "pane" | "worksheet";
+ export type BIPaneSettings = {
+ /**
+ * Ordered dimension IDs used to split returned groups into separate charts.
+ */
+ fields: Array<string>;
+ independentAxes?: (boolean | null) | undefined;
+ referenceLines?: (ReferenceLines | null) | undefined;
+ };
export type Operator2 =
| "equals"
| "not_equals"
@@ -4798,6 +4807,7 @@ export namespace Schemas {
localFields?: (Array<BIField> | null) | undefined;
memberAliases?: (Array<MemberAliase> | null) | undefined;
missingDates?: (MissingDates | null) | undefined;
+ panes?: (BIPaneSettings | null) | undefined;
resultFilterGroup?: (BIConditionGroup | null) | undefined;
resultFilters?: (Array<BIResultFilter> | null) | undefined;
rowFilterGroup?: (BIConditionGroup | null) | undefined;
diff --git a/products/product_analytics/frontend/generated/api.schemas.ts b/products/product_analytics/frontend/generated/api.schemas.ts
index c882279d98ee..4ad3fa270222 100644
--- a/products/product_analytics/frontend/generated/api.schemas.ts
+++ b/products/product_analytics/frontend/generated/api.schemas.ts
@@ -8482,6 +8482,22 @@ export const MissingDatesApi = {
Zero: 'zero',
} as const
+export type ReferenceLinesApi = (typeof ReferenceLinesApi)[keyof typeof ReferenceLinesApi]
+
+export const ReferenceLinesApi = {
+ Pane: 'pane',
+ Worksheet: 'worksheet',
+} as const
+
+export interface BIPaneSettingsApi {
+ /** Ordered dimension IDs used to split returned groups into separate charts. */
+ fields: string[]
+ /** Use a separate value scale for each pane instead of a shared primary scale. */
+ independentAxes?: boolean | null
+ /** Calculate reference lines from each pane or from all returned worksheet marks. */
+ referenceLines?: ReferenceLinesApi | null
+}
+
export type Operator1Api = (typeof Operator1Api)[keyof typeof Operator1Api]
export const Operator1Api = {
@@ -8619,6 +8635,8 @@ export interface BIConfigApi {
memberAliases?: MemberAliaseApi[] | null
/** Fill missing date buckets before table calculations. Unset preserves observed points only. */
missingDates?: MissingDatesApi | null
+ /** Split the returned groups into charts using these ordered dimension IDs. */
+ panes?: BIPaneSettingsApi | null
resultFilterGroup?: BIConditionGroupApi | null
resultFilters?: BIResultFilterApi[] | null
rowFilterGroup?: BIConditionGroupApi | null
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index eb6e551eeb66..f6a532379138 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -10985,6 +10985,23 @@ export namespace Schemas {
Zero: 'zero',
} as const;
+ export type ReferenceLines = typeof ReferenceLines[keyof typeof ReferenceLines];
+
+
+ export const ReferenceLines = {
+ Pane: 'pane',
+ Worksheet: 'worksheet',
+ } as const;
+
+ export interface BIPaneSettings {
+ /** Ordered dimension IDs used to split returned groups into separate charts. */
+ fields: string[];
+ /** Use a separate value scale for each pane instead of a shared primary scale. */
+ independentAxes?: boolean | null;
+ /** Calculate reference lines from each pane or from all returned worksheet marks. */
+ referenceLines?: ReferenceLines | null;
+ }
+
export type Operator1 = typeof Operator1[keyof typeof Operator1];
@@ -11128,6 +11145,8 @@ export namespace Schemas {
memberAliases?: MemberAliase[] | null;
/** Fill missing date buckets before table calculations. Unset preserves observed points only. */
missingDates?: MissingDates | null;
+ /** Split the returned groups into charts using these ordered dimension IDs. */
+ panes?: BIPaneSettings | null;
resultFilterGroup?: BIConditionGroup | null;
resultFilters?: BIResultFilter[] | null;
rowFilterGroup?: BIConditionGroup | null;