cube-js / cube-js/cube

[Feature request] Post-aggregate measure filters

Open
#8,804 5 comments 2 reactions 0 assignees View on GitHub
data modeling question
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

Hi!
Based on the Cube roadmap (https://github.com/cube-js/cube/issues/8486), we understand that you are currently working on post-aggregate metrics and dimensions.

We found a guide on how to calculate cohort retention (https://cube.dev/docs/guides/recipes/analytics/cohort-retention). However, the method described there is not dynamic and consumes significant resources due to the need for joins that multiply the dataset several times.

Moreover, if we want to segment the data by a dimensions other than date (e.g., device type, date, country, ...), we would need to rewrite the main SQL query.

In our testing of post-aggregate measures, we noticed that properties like `reduce_by` and `group_by` could potentially solve this issue. However, if Cube applies all filters to each post-aggregate measure, it can cause complications.

We suggest adding a specific parameter that allows defining which filters are applied to a particular measure if parameter is set. This would enable truly dynamic cohort analysis.

For example, by adding a property like:
```javascript
propagate_filters: [dim1, dim2, ...]
```

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.