dbt-labs / dbt-labs/metricflow

[SL-3383] [Feature] Allow cumulative metrics without having to pre-define them

Open
#1,528 0 comments 0 reactions 0 assignees View on GitHub
enhancement linear triage
Dominant language
Python
Stars
1.8k
Forks
202
Avg merge
1d 8h
Merged PRs (30d)
14

Description

### Is this your first time submitting a feature request?

- [X] I have read the [expectations for open source contributors](https://docs.getdbt.com/docs/contributing/oss-expectations)
- [X] I have searched the existing issues, and I could not 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

Allow users to query cumulative values of metrics without developers having to pre-define the metrics.
If necessary, there can be additional configurations that specify which cumulative calculations to enable or disable.

Ideally, we would define a metric (`some_metric`) and we would immediately be able to query a cumulative version of that metric, something like this:
```
mf query --metircs some_metric,cumulative_7_day__some_metric --group-by metric_time
```

That is, the cumulation parameters would be query-time, not definition time.

### Describe alternatives you've considered

Currently we have to pre-configure all the cumulative metrics we want to allow, which is limiting and code-intensive. For example:

```
- name: some_metric_in_7_days
label: some_metric_in_7_days
description: ...
type: cumulative
type_params:
measure: some_measure
window: 7 days
```
to enable the 7-day cumulative and another one for every other window we want to allow.

### Who will this benefit?

Everyone using metrics

### Are you interested in contributing this feature?

Happy to provide context, sample use cases, brainstorm etc

### Anything else?

_No response_

[SL-3383](https://linear.app/dbt-labs/issue/SL-3383/[feature]-allow-cumulative-metrics-without-having-to-pre-define-them)

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.