-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Support referencing a metric in where filter #273
Labels
Comments
@QMalcolm This is the proposed interface change for metrics as dimensions. Can you help us scope the LOE for this change? |
courtneyholcomb
added a commit
that referenced
this issue
Mar 19, 2024
Resolves #273 Resolves SL-1849 <!--- Include the number of the issue addressed by this PR above if applicable. PRs for code changes without an associated issue *will not be merged*. See CONTRIBUTING.md for more information. --> ### Description Allow users to reference metrics in where filters for metrics, measures, and saved queries. This uses syntax like: `{{ Metric('metric_name', group_by=['entity_name', 'dimension_name']) }} = 10` This unlocks new types of metrics that users have been asking for. Some examples can be found in the linked issue and in [this design doc](https://www.notion.so/dbtlabs/Metrics-as-Dimensions-55718e9516a7462787ffd6e3e8c1237e?pvs=4). ### Checklist - [x] I have read [the contributing guide](https://github.com/dbt-labs/dbt-semantic-interfaces/blob/main/CONTRIBUTING.md) and understand what's expected of me - [x] I have signed the [CLA](https://docs.getdbt.com/docs/contributor-license-agreements) - [x] This PR includes tests, or tests are not required/relevant for this PR - [x] I have run `changie new` to [create a changelog entry](https://github.com/dbt-labs/dbt-semantic-interfaces/blob/main/CONTRIBUTING.md#adding-a-changelog-entry)
courtneyholcomb
added a commit
that referenced
this issue
Mar 19, 2024
Resolves #273 Resolves SL-1849 <!--- Include the number of the issue addressed by this PR above if applicable. PRs for code changes without an associated issue *will not be merged*. See CONTRIBUTING.md for more information. --> ### Description Allow users to reference metrics in where filters for metrics, measures, and saved queries. This uses syntax like: `{{ Metric('metric_name', group_by=['entity_name', 'dimension_name']) }} = 10` This unlocks new types of metrics that users have been asking for. Some examples can be found in the linked issue and in [this design doc](https://www.notion.so/dbtlabs/Metrics-as-Dimensions-55718e9516a7462787ffd6e3e8c1237e?pvs=4). ### Checklist - [x] I have read [the contributing guide](https://github.com/dbt-labs/dbt-semantic-interfaces/blob/main/CONTRIBUTING.md) and understand what's expected of me - [x] I have signed the [CLA](https://docs.getdbt.com/docs/contributor-license-agreements) - [x] This PR includes tests, or tests are not required/relevant for this PR - [x] I have run `changie new` to [create a changelog entry](https://github.com/dbt-labs/dbt-semantic-interfaces/blob/main/CONTRIBUTING.md#adding-a-changelog-entry)
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is this your first time submitting a feature request?
Describe the feature
Context
Some metrics require multiple aggregations or dependencies on other metrics. For example, Streamlit measures “super users” which is calculated as a distinct count of users who have 10+ active days in the last 70 days. Notion measures “activated spaces” which is calculated as a distinct count of spaces where at least two users have two active days within the first 7 days of space creation. Both of these metrics require dependencies on some aggregation in order to produce the end metric and MetricFlow has no path to supporting this today. This paradigm is sometimes called “metrics as dimensions” by our users where an aggregation is an input to the metric definition.
Our plan to support this enable referencing a metric in a filter.
The general interface update is:
For example in a metric config:
In a CLI query:
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
The text was updated successfully, but these errors were encountered: