cube-js / cube-js/cube

[Feature request] Use dimensions from pre-aggregations to calculate measures

Open
#8,763 1 comment 0 reactions 1 assignee Claimed by @igorlukanin View on GitHub
cube store
Dominant language
Rust
Stars
20.8k
Forks
2.1k
Avg merge
1d 2h
Merged PRs (30d)
181

Description

Hi there!

We’re trying to build a cube like the one below, and we expected it to use pre-aggregations to calculate the `metric` because the `pre_aggregations` include the `day` dimension. However, the generated query doesn’t seem to involve the pre-aggregations.

**Feature Request:** Use dimensions from pre-aggregations to calculate measures.

```javascript
cube('model', {
public: false,
title: 'model',

sql: `SELECT 1 as metric, 1 as day`,

dimensions: {
day: {
sql: `day`,
type: 'number'
}
},

measures: {
metric: {
sql: `${day}`,
type: `count_distinct`
}
},

pre_aggregations: {
model_rollup: {
measures: [],
dimensions: [
CUBE.day
],
external: false,
}
}
});
```

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.