dbt-labs / dbt-labs/metricflow

[SL-2585] Time filters are not applied to the time spine table when join to timespine = true

Open
#1,489 20 comments 0 reactions 1 assignee Claimed by @courtneyholcomb View on GitHub
High priority linear Metricflow
Dominant language
Python
Stars
1.8k
Forks
202
Avg merge
1d 8h
Merged PRs (30d)
14

Description

2 bugs here:

1. When you filter on a metric_time that's not in the group by, it won't be reapplied. This bug I have found.
1. Planned fix: Apply any metric_time/agg_time filter constraints to the time spine table before joining to the source table. This is necessary because the column to be filtered won't be available after aggregating. Note that this will need to filter any grain, so we might choose a different time spine table for the query if there is a filter on a smaller grain than what is in the group by.
2. When you filter on a metric_time that IS in the group by, it won't be reapplied. I'm hoping my fix for the prior will also fix this. TODO: try to repro! Do this before the fix on the other one to make sure you don't duplicate work.

🟡 Time filters are not being applied to the time spine table when join to timespine = true. cc @courtney.holcomb @tomkit.lento [https://dbt-labs.slack.com/archives/C06UEFM66P5/p1719607978179819](https://dbt-labs.slack.com/archives/C06UEFM66P5/p1719607978179819)1.

\[June 28th, 2024 1:52 PM\] ben.kramer: Friday Afternoon Question - Not Urgent!
If i want to produce a saved query grouped by `metric_time`, is there a way to limit the results to a subset of days when `join_to_time_spine is true`?

I added filters to my where clause but those filters apply within the subquery (see thread)

From [SyncLinear.com](https://synclinear.com) | [SL-2585](https://linear.app/dbt-labs/issue/SL-2585/time-filters-are-not-applied-to-the-time-spine-table-when-join-to)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.