propagate only timeDimensions to subQuery
- Dominant language
- Rust
- Stars
- 20.8k
- Forks
- 2.1k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 181
Description
I am trying to work on a scenario in which several dimension should be calculated based sub query of another cube.
When propagating filters to the sub_query, I want to be able to propagate only the timeDimension so I could for example calculate the average or percentile of all values regardless of the other dimension filters.
I think the solution should be easy, add another property to `dimension` called `propagate_time_dimensions_to_sub_query ` that behaves just like `propagate_filters_to_sub_query` just does't pass the segments and the filters value.
The code [here](https://github.com/cube-js/cube/blob/5ce589a1e7b3f8e3f850fdc9abadb26e212f2da4/packages/cubejs-schema-compiler/src/adapter/BaseQuery.js#L1575)
So we can just do:
```js
if (symbol.propagateTimeDimensionsToSubQuery) {
timeDimensions = this.filtersWithoutSubQueries.filter(
f => f instanceof BaseTimeDimension
).map(f => ({
dimension: f.dimension,
dateRange: f.dateRange
}));
```
I think I can do that myself, if you think this feature is valuable to others.
Contributor guide
Assessment
This issue has not been assessed yet.