: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(dashboards): allow excluding tiles from dashboard filters (#72720)
Thomas Obermüllerc73b3c3d3887
diff --git a/frontend/src/lib/components/Cards/InsightCard/InsightDetails.test.tsx b/frontend/src/lib/components/Cards/InsightCard/InsightDetails.test.tsxindex c86e6cc62205..a34d55c3ea6d 100644--- a/frontend/src/lib/components/Cards/InsightCard/InsightDetails.test.tsx+++ b/frontend/src/lib/components/Cards/InsightCard/InsightDetails.test.tsx@@ -227,5 +227,33 @@ describe('InsightDetails', () => {expect(result.filterTestAccounts).toEqual({ value: true, source: 'dashboard' })expect(result.interval).toEqual({ value: 'week', source: 'dashboard' })})++ it('drops the whole dashboard layer when the tile ignores dashboard filters (raw-props fallback)', () => {+ const result = getEffectiveFilterOverrides(+ undefined,+ { properties: [countryUS], filterTestAccounts: true, interval: 'month' } as any,+ { ignoreDashboardFilters: true, properties: [browserChrome] } as any+ )++ expect(result.ignoresDashboardFilters).toBe(true)+ expect(result.propertyGroups).toEqual([{ properties: [browserChrome], source: 'tile' }])+ expect(result.filterTestAccounts).toBeNull()+ expect(result.interval).toBeNull()+ })++ it('reports the ignore flag from the backend context tile layer', () => {+ const result = getEffectiveFilterOverrides(+ {+ dashboard: null,+ tile: { ignoreDashboardFilters: true },+ overridden_dashboard: { filterTestAccounts: true },+ } as any,+ { filterTestAccounts: true } as any,+ undefined+ )++ expect(result.ignoresDashboardFilters).toBe(true)+ expect(result.filterTestAccounts).toBeNull()+ })})})diff --git a/frontend/src/lib/components/Cards/InsightCard/InsightDetails.tsx b/frontend/src/lib/components/Cards/InsightCard/InsightDetails.tsxindex 7525a3caaa20..cd59ec17ee76 100644--- a/frontend/src/lib/components/Cards/InsightCard/InsightDetails.tsx+++ b/frontend/src/lib/components/Cards/InsightCard/InsightDetails.tsx@@ -713,6 +713,7 @@ export const InsightDetails = React.memo(breakdown: overrideBreakdown,interval: overrideInterval,filterTestAccounts: overrideFilterTestAccounts,+ ignoresDashboardFilters,} = getEffectiveFilterOverrides(filterOverrideContext, filtersOverride, tileFiltersOverride)const insightDateRange = isInsightVizNode(query) ? query.source.dateRange : undefinedconst dateOverride = getDateRangeOverrideDisplay(@@ -741,6 +742,11 @@ export const InsightDetails = React.memo(variables={isHogQLQuery(query.source) ? query.source.variables : undefined}variablesOverride={variablesOverride}/>+ {ignoresDashboardFilters && (+ <InsightDetailSectionDisplay icon={<IconFilter />} label="Dashboard filters">+ <span>Ignored for this insight</span>+ </InsightDetailSectionDisplay>+ )}{dateOverride && (<DateRangeSummarydateFrom={dateOverride.dateFrom}diff --git a/frontend/src/lib/components/Cards/InsightCard/InsightMeta.tsx b/frontend/src/lib/components/Cards/InsightCard/InsightMeta.tsxindex 8c25dab049e9..c6d6fd0b4507 100644--- a/frontend/src/lib/components/Cards/InsightCard/InsightMeta.tsx+++ b/frontend/src/lib/components/Cards/InsightCard/InsightMeta.tsx@@ -111,7 +111,13 @@ export function getEffectiveDateOverride(filtersOverride: DashboardFilter | undefined,tileFiltersOverride: TileFilters | undefined): { dateFromOverride: string | null | undefined; dateToOverride: string | null | undefined } {- const dashboardFilters = filterOverrideContext ? filterOverrideContext.dashboard : filtersOverride+ // The backend context already resolves the ignore flag into an empty dashboard layer; the raw-props+ // fallback has to apply it itself.+ const dashboardFilters = filterOverrideContext+ ? filterOverrideContext.dashboard+ : tileFiltersOverride?.ignoreDashboardFilters+ ? undefined+ : filtersOverrideconst tileFilters = filterOverrideContext ? filterOverrideContext.tile : tileFiltersOverrideconst tileHasDate = tileFilters?.date_from != null || tileFilters?.date_to != nullconst source = tileHasDate ? tileFilters : dashboardFilters@@ -198,12 +204,15 @@ export function InsightMeta({const isSqlInsight = isDataVisualizationNode(insight.query)const showCompactHeading = !showCompactTile || !isSqlInsight- const hasTileOverrides = Object.keys(tileFiltersOverride ?? {}).length > 0+ const ignoresDashboardFilters = !!tileFiltersOverride?.ignoreDashboardFilters+ // The ignore flag is surfaced by its own notice, so it alone shouldn't trigger the overrides warning.+ const hasTileOverrides = Object.keys(tileFiltersOverride ?? {}).some((key) => key !== 'ignoreDashboardFilters')const dateOverride = getEffectiveDateOverride(insight.filter_override_context, filtersOverride, tileFiltersOverride)const topHeadingProps = {query: insight.query,lastRefresh: insight.last_refresh,hasTileOverrides,+ ignoresDashboardFilters,resolvedDateRange: insightData?.resolved_date_range,...dateOverride,}diff --git a/frontend/src/lib/components/Cards/InsightCard/TileOverridesWarning.tsx b/frontend/src/lib/components/Cards/InsightCard/TileOverridesWarning.tsxindex 41e962e07829..c983c2ba2fcf 100644--- a/frontend/src/lib/components/Cards/InsightCard/TileOverridesWarning.tsx+++ b/frontend/src/lib/components/Cards/InsightCard/TileOverridesWarning.tsx@@ -1,4 +1,4 @@-import { IconWarning } from '@posthog/icons'+import { IconFilter, IconWarning } from '@posthog/icons'import { Tooltip } from 'lib/lemon-ui/Tooltip'@@ -17,3 +17,13 @@ export function TileOverridesWarning(): JSX.Element | null {</Tooltip>)}++export function IgnoresDashboardFiltersNotice(): JSX.Element | null {+ return (+ <Tooltip title="None of the dashboard's filters apply to this insight. Its own tile overrides still do.">+ <div className="flex items-center gap-1 text-muted-alt">+ <IconFilter /> Ignores dashboard filters+ </div>+ </Tooltip>+ )+}diff --git a/frontend/src/lib/components/Cards/InsightCard/TopHeading.tsx b/frontend/src/lib/components/Cards/InsightCard/TopHeading.tsxindex 976c76359279..f95b27f703a0 100644--- a/frontend/src/lib/components/Cards/InsightCard/TopHeading.tsx+++ b/frontend/src/lib/components/Cards/InsightCard/TopHeading.tsx@@ -14,7 +14,7 @@ import {} from '~/queries/utils'import { InsightFreshness } from './InsightFreshness'-import { TileOverridesWarning } from './TileOverridesWarning'+import { IgnoresDashboardFiltersNotice, TileOverridesWarning } from './TileOverridesWarning'function getInsightType(query: Node | null): InsightTypeMetadata {if (query?.kind) {@@ -30,6 +30,7 @@ export function TopHeading({query,lastRefresh,hasTileOverrides,+ ignoresDashboardFilters,resolvedDateRange,showInsightType = true,showDate = true,@@ -39,6 +40,7 @@ export function TopHeading({query: Node | nulllastRefresh?: string | nullhasTileOverrides?: boolean | null+ ignoresDashboardFilters?: boolean | nullresolvedDateRange?: ResolvedDateRangeResponse | nullshowInsightType?: booleanshowDate?: boolean@@ -85,6 +87,7 @@ export function TopHeading({{/* Freshness clock lives in the date row — without a date it would hold the row open on its own. */}{dateLabel && lastRefresh ? <InsightFreshness lastRefresh={lastRefresh} /> : null}{hasTileOverrides ? <TileOverridesWarning /> : null}+ {ignoresDashboardFilters ? <IgnoresDashboardFiltersNotice /> : null}</CardTopHeadingRow>)}diff --git a/frontend/src/lib/components/Cards/InsightCard/insightDetailsFilterOverrides.ts b/frontend/src/lib/components/Cards/InsightCard/insightDetailsFilterOverrides.tsindex f9419323d1a2..a64cccb84743 100644--- a/frontend/src/lib/components/Cards/InsightCard/insightDetailsFilterOverrides.ts+++ b/frontend/src/lib/components/Cards/InsightCard/insightDetailsFilterOverrides.ts@@ -9,6 +9,13 @@ export interface EffectiveFilterOverrides {breakdown: { breakdownFilter: NonNullable<DashboardFilter['breakdown_filter']>; source: OverrideSource } | nullinterval: { value: IntervalType; source: OverrideSource } | nullfilterTestAccounts: { value: boolean; source: OverrideSource } | null+ ignoresDashboardFilters: boolean+}++// The generated context type lags behind TileFilters until the OpenAPI types are rebuilt, so read the+// flag through the schema type.+function ignoresDashboardFilters(tileFilters: unknown): boolean {+ return !!(tileFilters as TileFilters | null | undefined)?.ignoreDashboardFilters}// Tile beats dashboard; `!= null` (not truthiness) so a force-off `filterTestAccounts: false` still counts.@@ -28,8 +35,15 @@ export function getEffectiveFilterOverrides(filtersOverride: DashboardFilter | undefined,tileFiltersOverride: TileFilters | null | undefined): EffectiveFilterOverrides {- const dashboardFilters = filterOverrideContext ? filterOverrideContext.dashboard : filtersOverrideconst tileFilters = filterOverrideContext ? filterOverrideContext.tile : tileFiltersOverride+ const tileIgnoresDashboard = ignoresDashboardFilters(tileFilters)+ // The backend context already resolves the ignore flag into an empty dashboard layer; the raw-props+ // fallback has to apply it itself.+ const dashboardFilters = filterOverrideContext+ ? filterOverrideContext.dashboard+ : tileIgnoresDashboard+ ? undefined+ : filtersOverrideconst dashboardProperties = (dashboardFilters?.properties ?? []) as AnyPropertyFilter[]const tileProperties = (tileFilters?.properties ?? []) as AnyPropertyFilter[]const overriddenByTile = (filterOverrideContext?.overridden_dashboard?.properties ?? []) as AnyPropertyFilter[]@@ -55,7 +69,14 @@ export function getEffectiveFilterOverrides(dashboardFilters?.filterTestAccounts)- return { propertyGroups, overriddenByTile, breakdown, interval, filterTestAccounts }+ return {+ propertyGroups,+ overriddenByTile,+ breakdown,+ interval,+ filterTestAccounts,+ ignoresDashboardFilters: tileIgnoresDashboard,+ }}interface DateRangeSource {@@ -88,8 +109,12 @@ export function getDateRangeOverrideDisplay(filtersOverride: DashboardFilter | undefined,tileFiltersOverride: TileFilters | null | undefined): EffectiveDateOverride | null {- const dashboardFilters = filterOverrideContext ? filterOverrideContext.dashboard : filtersOverrideconst tileFilters = filterOverrideContext ? filterOverrideContext.tile : tileFiltersOverride+ const dashboardFilters = filterOverrideContext+ ? filterOverrideContext.dashboard+ : ignoresDashboardFilters(tileFilters)+ ? undefined+ : filtersOverridelet winner: {source: OverrideSourcedateFrom: string | null | undefineddiff --git a/frontend/src/lib/utils/eventUsageLogic.ts b/frontend/src/lib/utils/eventUsageLogic.tsindex afb9cda04566..283cdc35177e 100644--- a/frontend/src/lib/utils/eventUsageLogic.ts+++ b/frontend/src/lib/utils/eventUsageLogic.ts@@ -762,6 +762,15 @@ export interface eventUsageLogicActions {dashboardId: number | undefinedisShared: boolean}+ reportDashboardTileIgnoreDashboardFiltersToggled: (+ dashboardId: number | undefined,+ insightId: number | null,+ ignored: boolean+ ) => {+ dashboardId: number | undefined+ ignored: boolean+ insightId: number | null+ }reportDashboardTileInsertedInline: (tileType: DashboardAddTileType,column: number,@@ -2099,6 +2108,11 @@ export const eventUsageLogic = kea<eventUsageLogicType>([changeType: DashboardFilterChangeType,properties: Record<string, string | number | boolean | null | undefined>) => ({ dashboard, changeType, properties }),+ reportDashboardTileIgnoreDashboardFiltersToggled: (+ dashboardId: number | undefined,+ insightId: number | null,+ ignored: boolean+ ) => ({ dashboardId, insightId, ignored }),reportDashboardLayoutZoomChanged: (dashboard: DashboardType<QueryBasedInsightModel> | null,layoutZoom: number,@@ -3045,6 +3059,13 @@ export const eventUsageLogic = kea<eventUsageLogicType>([...properties,})},+ reportDashboardTileIgnoreDashboardFiltersToggled: async ({ dashboardId, insightId, ignored }) => {+ posthog.capture('dashboard tile ignore dashboard filters toggled', {+ dashboard_id: dashboardId,+ insight_id: insightId,+ ignored,+ })+ },reportDashboardLayoutZoomChanged: async ({ dashboard, layoutZoom, source }) => {posthog.capture('dashboard layout zoom changed', {dashboard_id: dashboard?.id,diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.jsonindex 841cafb0bc6f..5d868fc25faa 100644--- a/frontend/src/queries/schema.json+++ b/frontend/src/queries/schema.json@@ -50232,6 +50232,10 @@"filterTestAccounts": {"type": ["boolean", "null"]},+ "ignoreDashboardFilters": {+ "description": "When true, this tile ignores every dashboard-level filter; the tile's own overrides still apply.",+ "type": ["boolean", "null"]+ },"interval": {"anyOf": [{diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.tsindex 08792c55923b..d8707a5422d1 100644--- a/frontend/src/queries/schema/schema-general.ts+++ b/frontend/src/queries/schema/schema-general.ts@@ -5397,6 +5397,8 @@ export interface TileFilters {explicitDate?: boolean | undefinedinterval?: IntervalType | null | undefinedfilterTestAccounts?: boolean | null | undefined+ /** When true, this tile ignores every dashboard-level filter; the tile's own overrides still apply. */+ ignoreDashboardFilters?: boolean | null | undefined}export interface InsightsThresholdBounds {diff --git a/frontend/src/scenes/dashboard/TileFiltersOverride.tsx b/frontend/src/scenes/dashboard/TileFiltersOverride.tsxindex 902b01e6b76c..a3b186dcb069 100644--- a/frontend/src/scenes/dashboard/TileFiltersOverride.tsx+++ b/frontend/src/scenes/dashboard/TileFiltersOverride.tsx@@ -4,7 +4,7 @@ import './TileFiltersOverride.scss'import { useActions, useValues } from 'kea'import { IconCalendar } from '@posthog/icons'-import '@posthog/lemon-ui'+import { LemonSwitch } from '@posthog/lemon-ui'import { DateFilter } from 'lib/components/DateFilter/DateFilter'import { PropertyFilters } from 'lib/components/PropertyFilters/PropertyFilters'@@ -18,7 +18,7 @@ import { tileLogic } from './tileLogic'export function TileFiltersOverride({ tile }: { tile: DashboardTile<QueryBasedInsightModel> }): JSX.Element {const { overrides } = useValues(tileLogic)- const { setDates, setProperties } = useActions(tileLogic)+ const { setDates, setProperties, setIgnoreDashboardFilters } = useActions(tileLogic)const { groupsTaxonomicTypes } = useValues(groupsModel)const { hasPageview, hasScreen } = getProjectEventExistence()@@ -33,6 +33,20 @@ export function TileFiltersOverride({ tile }: { tile: DashboardTile<QueryBasedIn</div><div className="space-y-4">+ <div>+ <LemonSwitch+ checked={!!overrides.ignoreDashboardFilters}+ onChange={setIgnoreDashboardFilters}+ label="Ignore dashboard filters"+ bordered+ fullWidth+ data-attr="tile-ignore-dashboard-filters"+ />+ <p className="text-xs text-muted mt-1 mb-0">+ When on, none of the dashboard's filters apply to this insight. The overrides below still do.+ </p>+ </div>+<div><label className="text-sm font-medium mb-2 block">Date Range</label><DateFilterdiff --git a/frontend/src/scenes/dashboard/dashboardFilterEmpty.test.ts b/frontend/src/scenes/dashboard/dashboardFilterEmpty.test.tsindex 68c09b981fd4..fa0960e2062d 100644--- a/frontend/src/scenes/dashboard/dashboardFilterEmpty.test.ts+++ b/frontend/src/scenes/dashboard/dashboardFilterEmpty.test.ts@@ -12,6 +12,7 @@ describe('isDashboardFilterEmpty', () => {['null date fields + explicitDate false', { date_from: null, date_to: null, explicitDate: false }],['empty properties array', { properties: [] }],['filterTestAccounts null', { filterTestAccounts: null }],+ ['ignoreDashboardFilters false', { ignoreDashboardFilters: false }],]test.each(emptyCases)('returns true for %s', (_, filter) => {@@ -38,6 +39,7 @@ describe('isDashboardFilterEmpty', () => {['interval set', { interval: 'week' }],['filterTestAccounts forced on', { filterTestAccounts: true }],['filterTestAccounts forced off', { filterTestAccounts: false }],+ ['ignoreDashboardFilters set', { ignoreDashboardFilters: true }],]test.each(nonEmptyCases)('returns false for %s', (_, filter) => {diff --git a/frontend/src/scenes/dashboard/dashboardFilterEmpty.ts b/frontend/src/scenes/dashboard/dashboardFilterEmpty.tsindex eed09cfc0c2e..0727140986c0 100644--- a/frontend/src/scenes/dashboard/dashboardFilterEmpty.ts+++ b/frontend/src/scenes/dashboard/dashboardFilterEmpty.ts@@ -9,6 +9,7 @@ export function isDashboardFilterEmpty(filter: DashboardFilter | TileFilters | n(filter.properties == null || (Array.isArray(filter.properties) && filter.properties.length === 0)) &&filter.breakdown_filter == null &&filter.interval == null &&- filter.filterTestAccounts == null)+ filter.filterTestAccounts == null &&+ !(filter as TileFilters).ignoreDashboardFilters))}diff --git a/frontend/src/scenes/dashboard/dashboardLogic.tsx b/frontend/src/scenes/dashboard/dashboardLogic.tsxindex f2d6797234dd..0fdbbcaa9869 100644--- a/frontend/src/scenes/dashboard/dashboardLogic.tsx+++ b/frontend/src/scenes/dashboard/dashboardLogic.tsx@@ -4102,12 +4102,21 @@ export const dashboardLogic = kea<dashboardLogicType>([},onSubmit: async () => {const tileFilterOverrides = logic.values.overrides+ const wasIgnored = !!tile.filters_overrides?.ignoreDashboardFilters+ const isIgnored = !!tileFilterOverrides.ignoreDashboardFiltersawait api.update(`api/environments/${teamLogic.values.currentTeamId}/dashboards/${props.id}`, {tiles: [{ id: tile.id, filters_overrides: tileFilterOverrides }],})tile.filters_overrides = tileFilterOverrides+ if (wasIgnored !== isIgnored) {+ eventUsageLogic.actions.reportDashboardTileIgnoreDashboardFiltersToggled(+ props.id,+ tile.insight?.id ?? null,+ isIgnored+ )+ }actions.refreshDashboardItem({ tile })lemonToast.success('Tile filters saved')},diff --git a/frontend/src/scenes/dashboard/tileLogic.tsx b/frontend/src/scenes/dashboard/tileLogic.tsxindex fb722ff24560..2ba875b02164 100644--- a/frontend/src/scenes/dashboard/tileLogic.tsx+++ b/frontend/src/scenes/dashboard/tileLogic.tsx@@ -31,6 +31,9 @@ export interface tileLogicActions {date_to: string | null | undefinedexplicitDate: boolean | undefined}+ setIgnoreDashboardFilters: (ignoreDashboardFilters: boolean) => {+ ignoreDashboardFilters: boolean+ }setProperties: (properties: AnyPropertyFilter[] | null | undefined) => {properties: AnyPropertyFilter[] | null | undefined}@@ -60,6 +63,7 @@ export const tileLogic = kea<tileLogicType>([}),setProperties: (properties: AnyPropertyFilter[] | null | undefined) => ({ properties }),setBreakdown: (breakdown_filter: BreakdownFilter | null | undefined) => ({ breakdown_filter }),+ setIgnoreDashboardFilters: (ignoreDashboardFilters: boolean) => ({ ignoreDashboardFilters }),resetOverrides: true,})),@@ -96,6 +100,15 @@ export const tileLogic = kea<tileLogicType>([return newState},setBreakdown: (state, { breakdown_filter }) => ({ ...state, breakdown_filter }),+ setIgnoreDashboardFilters: (state, { ignoreDashboardFilters }) => {+ const newState = { ...state }+ if (ignoreDashboardFilters) {+ newState.ignoreDashboardFilters = true+ } else {+ delete newState.ignoreDashboardFilters+ }+ return newState+ },resetOverrides: () => ({}),},],diff --git a/posthog/hogql_queries/apply_dashboard_filters.py b/posthog/hogql_queries/apply_dashboard_filters.pyindex 691dce71be05..5dbf2bcc71f9 100644--- a/posthog/hogql_queries/apply_dashboard_filters.py+++ b/posthog/hogql_queries/apply_dashboard_filters.py@@ -14,6 +14,20 @@ _DATA_WAREHOUSE_NODE_KINDS = {"DataWarehouseNode", "FunnelsDataWarehouseNode", "# when set. Property filters are handled separately (stacked unless they contradict)._SCALAR_OVERRIDE_FIELDS = ["breakdown_filter", "interval", "filterTestAccounts"]+# Tile-only flag, not a filter value: it must never reach DashboardFilter(**effective_filters)+# (extra="forbid"), so every merged output strips it. It only acts on the override (tile) layer;+# in the base layer (e.g. smuggled in via the `filters_override` query param) it is stripped+# without effect, since a dashboard-layer "ignore dashboard filters" has no meaning.+_IGNORE_DASHBOARD_FILTERS = "ignoreDashboardFilters"+++def _ignores_dashboard_filters(filters: dict | None) -> bool:+ return bool(filters and filters.get(_IGNORE_DASHBOARD_FILTERS))+++def _without_ignore_flag(filters: dict) -> dict:+ return {key: value for key, value in filters.items() if key != _IGNORE_DASHBOARD_FILTERS}+class FilterLayerResolution(TypedDict):dashboard: dict@@ -24,10 +38,21 @@ class FilterLayerResolution(TypedDict):def resolve_filter_layers_by_priority(base_filters: dict | None, override_filters: dict | None) -> FilterLayerResolution:- base = base_filters or {}+ base = _without_ignore_flag(base_filters or {})override = override_filters or {}++ if _ignores_dashboard_filters(override):+ overridden_base: dict = {key: value for key, value in base.items() if value is not None}+ if overridden_base.get("properties") is not None:+ overridden_base["properties"] = flatten_property_leaves(overridden_base["properties"])+ return {+ "dashboard": {},+ "tile": override,+ "overridden_dashboard": overridden_base,+ }+effective_base = {**base}- overridden_base: dict = {}+ overridden_base = {}for field in _SCALAR_OVERRIDE_FIELDS:if override.get(field) is not None:@@ -87,11 +112,26 @@ def merge_filters_by_priority(base_filters: dict | None, override_filters: dictOverriding the insight's own base filters (not just the lower-priority layer's) is handled separatelyby `remove_query_properties_overridden_by`, which the override-aware call sites apply to the query.++ An override with `ignoreDashboardFilters` drops the base layer entirely: only the override's own+ values apply. The flag itself is stripped from every merged result, since the output feeds+ `DashboardFilter(**...)` which forbids extra keys. In the base layer the flag is stripped without+ acting — it is tile-only, but clients can place it in `base_filters` via the `filters_override`+ query param."""+ if base_filters:+ base_filters = _without_ignore_flag(base_filters)+ if override_filters:+ if override_filters.get(_IGNORE_DASHBOARD_FILTERS):+ effective = _without_ignore_flag(override_filters)+ if effective.get("properties") is not None:+ effective["properties"] = flatten_property_leaves(effective["properties"])+ return effective+ override_filters = _without_ignore_flag(override_filters)if not override_filters:return base_filters or {}if not base_filters:- return override_filters or {}+ return override_filtersresolved_layers = resolve_filter_layers_by_priority(base_filters, override_filters)merged = {**resolved_layers["dashboard"]}@@ -229,7 +269,9 @@ def resolve_effective_dashboard_filters() -> tuple[dict, dict]:"""Combine dashboard and tile filters for query execution and display reconstruction."""effective_filters = (- merge_filters_by_priority(base_filters, tile_filters_override) if tile_filters_override else base_filters or {}+ merge_filters_by_priority(base_filters, tile_filters_override)+ if tile_filters_override+ else _without_ignore_flag(base_filters or {}))# `merge_filters_by_priority` can early-return a raw layer (and a single layer is unmerged), so# `properties` may still be a group dict here — normalize before it reaches `DashboardFilter`.@@ -241,6 +283,10 @@ def resolve_effective_dashboard_filters(def dashboard_filter_from_dict(filters: dict) -> DashboardFilter:"""Build a dashboard filter while tolerating legacy grouped properties."""+ # Final guard: callers like Insight.get_effective_query pass client-supplied filter dicts+ # here without going through the merge functions, and the tile-only flag would trip+ # DashboardFilter's extra="forbid".+ filters = _without_ignore_flag(filters)if isinstance(filters.get("properties"), dict):filters = {**filters, "properties": flatten_property_leaves(filters["properties"])}return DashboardFilter(**filters)diff --git a/posthog/hogql_queries/test/test_merge_filters_by_priority.py b/posthog/hogql_queries/test/test_merge_filters_by_priority.pyindex 76ae432305f2..7ca8796eb7ff 100644--- a/posthog/hogql_queries/test/test_merge_filters_by_priority.py+++ b/posthog/hogql_queries/test/test_merge_filters_by_priority.py@@ -2,6 +2,8 @@ from django.test import SimpleTestCasefrom parameterized import parameterized+from posthog.schema import DashboardFilter+from posthog.hogql_queries.apply_dashboard_filters import (dashboard_filter_from_dict,flatten_property_leaves,@@ -211,6 +213,98 @@ class TestResolveEffectiveDashboardFilters(SimpleTestCase):assert effective["date_from"] == "-7d"+class TestIgnoreDashboardFilters(SimpleTestCase):+ _DASHBOARD = {+ "date_from": "-30d",+ "properties": [{"key": "$browser", "value": "Chrome", "type": "event"}],+ "interval": "day",+ "filterTestAccounts": True,+ }++ @parameterized.expand(+ [+ ("dashboard has filters", _DASHBOARD),+ ("dashboard empty", None),+ ]+ )+ def test_flag_drops_dashboard_layer_and_keeps_tile_values(self, _name, dashboard):+ merged = merge_filters_by_priority(dashboard, {"ignoreDashboardFilters": True, "date_from": "-7d"})++ assert merged == {"date_from": "-7d"}+ DashboardFilter(**merged) # the flag must never reach the extra="forbid" model++ def test_flag_only_tile_yields_empty_effective_filters(self):+ merged = merge_filters_by_priority(self._DASHBOARD, {"ignoreDashboardFilters": True})++ assert merged == {}++ def test_flag_with_property_group_tile_filters_flattens_for_query_application(self):+ merged = merge_filters_by_priority(+ self._DASHBOARD,+ {+ "ignoreDashboardFilters": True,+ "properties": {+ "type": "AND",+ "values": [{"type": "AND", "values": [{"key": "$browser", "value": "Chrome", "type": "event"}]}],+ },+ },+ )++ assert merged == {"properties": [{"key": "$browser", "value": "Chrome", "type": "event"}]}++ def test_false_flag_merges_normally_and_is_stripped(self):+ merged = merge_filters_by_priority({"date_from": "-30d"}, {"ignoreDashboardFilters": False, "interval": "week"})++ assert merged == {"date_from": "-30d", "interval": "week"}+ DashboardFilter(**merged)++ @parameterized.expand(+ [+ ("no tile override", None, {"date_from": "-30d"}),+ (+ "tile override present",+ {"interval": "week"},+ {"date_from": "-30d", "interval": "week"},+ ),+ ]+ )+ def test_flag_in_base_layer_is_stripped_without_dropping_the_layer(self, _name, tile, expected):+ base = {"ignoreDashboardFilters": True, "date_from": "-30d"}++ merged = merge_filters_by_priority(base, tile)++ assert merged == expected+ DashboardFilter(**merged)++ def test_flag_in_base_layer_does_not_reach_effective_filters(self):+ query = {"kind": "TrendsQuery", "series": []}++ _, effective = resolve_effective_dashboard_filters(+ query, {"ignoreDashboardFilters": True, "date_from": "-30d"}, None+ )++ assert effective == {"date_from": "-30d"}+ DashboardFilter(**effective)++ def test_dashboard_filter_from_dict_strips_flag(self):+ assert dashboard_filter_from_dict({"ignoreDashboardFilters": True, "date_from": "-30d"}) == DashboardFilter(+ date_from="-30d"+ )++ def test_resolve_layers_reports_dashboard_as_fully_overridden(self):+ tile_prop = {"key": "$country", "value": "US", "type": "event"}++ resolved = resolve_filter_layers_by_priority(+ self._DASHBOARD, {"ignoreDashboardFilters": True, "properties": [tile_prop]}+ )++ assert resolved == {+ "dashboard": {},+ "tile": {"ignoreDashboardFilters": True, "properties": [tile_prop]},+ "overridden_dashboard": self._DASHBOARD,+ }++class TestRemoveQueryPropertiesOverriddenBy(SimpleTestCase):def _query(self, properties):return {"kind": "InsightVizNode", "source": {"kind": "TrendsQuery", "properties": properties}}diff --git a/posthog/schema.py b/posthog/schema.pyindex 52bb5663e2e9..5b7eb575d8ba 100644--- a/posthog/schema.py+++ b/posthog/schema.py@@ -23232,6 +23232,12 @@ class TileFilters(BaseModel):date_to: str | None = NoneexplicitDate: bool | None = NonefilterTestAccounts: bool | None = None+ ignoreDashboardFilters: bool | None = Field(+ default=None,+ description=(+ "When true, this tile ignores every dashboard-level filter; the tile's own overrides still apply."+ ),+ )interval: IntervalType | None = Noneproperties: list[AnyPropertyFilterDiscriminated] | None = Nonediff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.tsindex 88219c760929..c3a47a8d12f4 100644--- a/products/dashboards/frontend/generated/api.schemas.ts+++ b/products/dashboards/frontend/generated/api.schemas.ts@@ -8351,11 +8351,49 @@ export interface DashboardFilterApi {| null}+export interface TileFiltersApi {+ breakdown_filter?: BreakdownFilterApi | null+ date_from?: string | null+ date_to?: string | null+ explicitDate?: boolean | null+ filterTestAccounts?: boolean | null+ /** When true, this tile ignores every dashboard-level filter; the tile's own overrides still apply. */+ ignoreDashboardFilters?: boolean | null+ interval?: IntervalTypeApi | null+ properties?:+ | (+ | EventPropertyFilterApi+ | PersonPropertyFilterApi+ | PersonMetadataPropertyFilterApi+ | ElementPropertyFilterApi+ | EventMetadataPropertyFilterApi+ | SessionPropertyFilterApi+ | CohortPropertyFilterApi+ | RecordingPropertyFilterApi+ | LogEntryPropertyFilterApi+ | GroupPropertyFilterApi+ | FeaturePropertyFilterApi+ | FlagPropertyFilterApi+ | HogQLPropertyFilterApi+ | EmptyPropertyFilterApi+ | DataWarehousePropertyFilterApi+ | DataWarehousePersonPropertyFilterApi+ | ErrorTrackingIssueFilterApi+ | LogPropertyFilterApi+ | MetricPropertyFilterApi+ | SpanPropertyFilterApi+ | RevenueAnalyticsPropertyFilterApi+ | AccountCustomPropertyFilterApi+ | WorkflowVariablePropertyFilterApi+ )[]+ | null+}+export interface InsightFilterOverrideContextApi {/** Dashboard filters that remain active after applying tile precedence. */dashboard?: DashboardFilterApi | null/** Tile filters applied above the dashboard filters. */- tile?: DashboardFilterApi | null+ tile?: TileFiltersApi | null/** Dashboard filters replaced by the tile filters. */overridden_dashboard?: DashboardFilterApi | null}diff --git a/products/product_analytics/backend/api/insight.py b/products/product_analytics/backend/api/insight.pyindex dd9ea8b0bdaa..b8a362147340 100644--- a/products/product_analytics/backend/api/insight.py+++ b/products/product_analytics/backend/api/insight.py@@ -552,7 +552,7 @@ class InsightFilterOverrideContext(BaseModel):dashboard: schema.DashboardFilter | None = PydanticField(default=None, description="Dashboard filters that remain active after applying tile precedence.")- tile: schema.DashboardFilter | None = PydanticField(+ tile: schema.TileFilters | None = PydanticField(default=None, description="Tile filters applied above the dashboard filters.")overridden_dashboard: schema.DashboardFilter | None = PydanticField(diff --git a/products/product_analytics/backend/api/test/test_insight.py b/products/product_analytics/backend/api/test/test_insight.pyindex d7fba10706cb..bfd8afbd2df3 100644--- a/products/product_analytics/backend/api/test/test_insight.py+++ b/products/product_analytics/backend/api/test/test_insight.py@@ -4388,6 +4388,52 @@ class TestInsight(ClickhouseTestMixin, APIBaseTest, QueryMatchingTest):},}+ def test_tile_ignoring_dashboard_filters_keeps_insight_query_untouched(self) -> None:+ # The tile opts out of dashboard filters entirely, so neither the dashboard's date range nor its+ # properties may reach the returned query; the tile's own overrides still apply.+ insight = Insight.objects.create(+ query={+ "kind": "InsightVizNode",+ "source": {+ "kind": "TrendsQuery",+ "series": [{"event": "$pageview", "kind": "EventsNode"}],+ "dateRange": {"date_from": "-90d"},+ },+ },+ team=self.team,+ )+ dashboard = Dashboard.objects.create(team=self.team, name="dashboard 1", created_by=self.user)+ DashboardTile.objects.create(+ dashboard=dashboard,+ insight=insight,+ filters_overrides={+ "ignoreDashboardFilters": True,+ "properties": [{"key": "$browser", "type": "event", "operator": "exact", "value": ["Firefox"]}],+ },+ )+ dashboard_filters = {+ "date_from": "-7d",+ "properties": [{"key": "$country", "type": "event", "operator": "exact", "value": ["US"]}],+ }++ response = self.client.get(+ f"/api/projects/{self.team.id}/insights/{insight.pk}",+ data={"from_dashboard": str(dashboard.pk), "filters_override": json.dumps(dashboard_filters)},+ ).json()++ source = response["query"]["source"]+ assert source["dateRange"]["date_from"] == "-90d"+ assert self._collect_property_values(source.get("properties"), "$country") == []+ assert self._collect_property_values(source.get("properties"), "$browser") == [["Firefox"]]+ assert response["filter_override_context"] == {+ "dashboard": None,+ "tile": {+ "ignoreDashboardFilters": True,+ "properties": [{"key": "$browser", "type": "event", "operator": "exact", "value": ["Firefox"]}],+ },+ "overridden_dashboard": dashboard_filters,+ }+def test_dashboard_property_override_replaces_insight_on_same_key(self) -> None:# Insight and dashboard both filter $browser, no tile. The dashboard must win on that key —# over the insight's own filter — instead of AND-ing (Chrome AND Safari would return nothing).diff --git a/products/product_analytics/frontend/generated/api.schemas.ts b/products/product_analytics/frontend/generated/api.schemas.tsindex 3b6ff63b1f8d..19b490954741 100644--- a/products/product_analytics/frontend/generated/api.schemas.ts+++ b/products/product_analytics/frontend/generated/api.schemas.ts@@ -7746,11 +7746,49 @@ export interface DashboardFilterApi {| null}+export interface TileFiltersApi {+ breakdown_filter?: BreakdownFilterApi | null+ date_from?: string | null+ date_to?: string | null+ explicitDate?: boolean | null+ filterTestAccounts?: boolean | null+ /** When true, this tile ignores every dashboard-level filter; the tile's own overrides still apply. */+ ignoreDashboardFilters?: boolean | null+ interval?: IntervalTypeApi | null+ properties?:+ | (+ | EventPropertyFilterApi+ | PersonPropertyFilterApi+ | PersonMetadataPropertyFilterApi+ | ElementPropertyFilterApi+ | EventMetadataPropertyFilterApi+ | SessionPropertyFilterApi+ | CohortPropertyFilterApi+ | RecordingPropertyFilterApi+ | LogEntryPropertyFilterApi+ | GroupPropertyFilterApi+ | FeaturePropertyFilterApi+ | FlagPropertyFilterApi+ | HogQLPropertyFilterApi+ | EmptyPropertyFilterApi+ | DataWarehousePropertyFilterApi+ | DataWarehousePersonPropertyFilterApi+ | ErrorTrackingIssueFilterApi+ | LogPropertyFilterApi+ | MetricPropertyFilterApi+ | SpanPropertyFilterApi+ | RevenueAnalyticsPropertyFilterApi+ | AccountCustomPropertyFilterApi+ | WorkflowVariablePropertyFilterApi+ )[]+ | null+}+export interface InsightFilterOverrideContextApi {/** Dashboard filters that remain active after applying tile precedence. */dashboard?: DashboardFilterApi | null/** Tile filters applied above the dashboard filters. */- tile?: DashboardFilterApi | null+ tile?: TileFiltersApi | null/** Dashboard filters replaced by the tile filters. */overridden_dashboard?: DashboardFilterApi | null}diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 57c292cfb263..e8ec870871d0 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -7935,11 +7935,23 @@ export namespace Schemas {properties?: (EventPropertyFilter | PersonPropertyFilter | PersonMetadataPropertyFilter | ElementPropertyFilter | EventMetadataPropertyFilter | SessionPropertyFilter | CohortPropertyFilter | RecordingPropertyFilter | LogEntryPropertyFilter | GroupPropertyFilter | FeaturePropertyFilter | FlagPropertyFilter | HogQLPropertyFilter | EmptyPropertyFilter | DataWarehousePropertyFilter | DataWarehousePersonPropertyFilter | ErrorTrackingIssueFilter | LogPropertyFilter | MetricPropertyFilter | SpanPropertyFilter | RevenueAnalyticsPropertyFilter | AccountCustomPropertyFilter | WorkflowVariablePropertyFilter)[] | null;}+ export interface TileFilters {+ breakdown_filter?: BreakdownFilter | null;+ date_from?: string | null;+ date_to?: string | null;+ explicitDate?: boolean | null;+ filterTestAccounts?: boolean | null;+ /** When true, this tile ignores every dashboard-level filter; the tile's own overrides still apply. */+ ignoreDashboardFilters?: boolean | null;+ interval?: IntervalType | null;+ properties?: (EventPropertyFilter | PersonPropertyFilter | PersonMetadataPropertyFilter | ElementPropertyFilter | EventMetadataPropertyFilter | SessionPropertyFilter | CohortPropertyFilter | RecordingPropertyFilter | LogEntryPropertyFilter | GroupPropertyFilter | FeaturePropertyFilter | FlagPropertyFilter | HogQLPropertyFilter | EmptyPropertyFilter | DataWarehousePropertyFilter | DataWarehousePersonPropertyFilter | ErrorTrackingIssueFilter | LogPropertyFilter | MetricPropertyFilter | SpanPropertyFilter | RevenueAnalyticsPropertyFilter | AccountCustomPropertyFilter | WorkflowVariablePropertyFilter)[] | null;+ }+export interface InsightFilterOverrideContext {/** Dashboard filters that remain active after applying tile precedence. */dashboard?: DashboardFilter | null;/** Tile filters applied above the dashboard filters. */- tile?: DashboardFilter | null;+ tile?: TileFilters | null;/** Dashboard filters replaced by the tile filters. */overridden_dashboard?: DashboardFilter | null;}