metricflow
metricflow copied to clipboard
[SL-1711] [Feature] Support resolution of time dimension grain when using Dimension() object syntax
Is this your first time submitting a feature request?
- [X] I have read the expectations for open source contributors
- [X] I have searched the existing issues, and I could ncot find an existing issue for this feature
- [X] I am requesting a straightforward extension of existing metricflow functionality, rather than a Big Idea better suited to a discussion
Describe the feature
Currently we only support ambiguous resolution of time grains if you use the TimeDimension()
object syntax. For example:
select
*
from {{semantic_layer.query(
metrics = ['revenue'],
where = "{{TimeDimension('metric_time')}} > 2024-01-01"
)
}}
Will resolve to the lowest granularity for metric time. If instead, I use the Dimenson()
object syntax this query will error
select
*
from {{semantic_layer.query(
metrics = ['revenue'],
where = "{{Dimension('metric_time')}} > 2024-01-01"
)
}}
We should be able to resolve to the lowest available granularity for either syntax.
This is currently blocking implementing supporting date_part in Tableau.
Describe alternatives you've considered
No response
Who will this benefit?
No response
Are you interested in contributing this feature?
No response
Anything else?
No response
From SyncLinear.com | SL-1711
One thing to add is that the use of {{ Dimension... }}
and {{ TimeDimension... }}
in filters inconsistent.
We need to be able to create a filter with:
- No grain, no date part ("exact date" in tableau)
- Only grain (DATE_TRUNC query in tableau)
- Only date part (EXTRACT query in tableau)
Currently, it seems like each syntax supports some (different) subset of these scenarios. I think either one or both of the different syntax should be able to cover all 3 scenarios.
@jordan.stein to see if this is fixed
Good one to followup on when caching is done.