-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Describe the bug
When trying to time shift a measure with a rolling window, the rolling window disappears on the time shifted measure.
To Reproduce
My original objective is to have a metric showing Quarter on Quarter change number, regardless of the granularity of the query. So I defined as a first step a measure with a rolling window of 3 months, that worked great; then I wanted to time-shift it by 3 months, so I could then calculate the ratio.
However, when querying the above metrics at monthly granularity, the count_rolling_3M_3M_ago values were those of count 3 months earlier, not those of count_rolling_3M
Expected behavior
I expect the values of count_rolling_3M_3M_ago in the above cube, when queried with monthly granularity, to equal to the values of count_rolling_3M 3 months earlier.
Screenshots
If applicable, add screenshots to help explain your problem.
Minimally reproducible Cube Schema
In case your bug report is data modelling related please put your minimally reproducible Cube Schema here.
You can use selects without tables in order to achieve that as follows.
- name: my_cube
dimensions:
- name: id
type: number
sql: id
primary_key: true
- name: date_at
type: time
sql: date_at
measures:
- name: count
type: count
- name: count_rolling_3M
rolling_window:
offset: end
trailing: 3 months
type: count
- name: count_rolling_3M_3M_ago
time_shift:
- time_dimension: date_at
interval: 3 months
type: prior
multi_stage: true
type: number
sql: '{count_rolling_3M}'Version:
cubejs/cube:latest as of August 18, 2025
Additional context
Add any other context about the problem here.