#12023·cube

Tesseract: rolling_window measure with granularity and no dateRange returns series shifted by one day

Author: xinch7Created Sep 27, 2026Updated Sep 27, 2026

Describe the bug

With Tesseract (default in 1.7), a rolling_window measure queried with a granularity but without a dateRange returns a series shifted by one day: the value labelled day d equals the correct trailing window ending on day d+1. With a dateRange, the same query returns correct values.

On 1.6.69, and on 1.7.46 with CUBEJS_TESSERACT_SQL_PLANNER=false, the query without dateRange is rejected with an error. So this is a silent wrong result on the new planner path.

To Reproduce

Schema below (synthetic rows, no tables). No pre-aggregation is involved.

json
{"measures": ["Repro.amount_7d"],
 "timeDimensions": [{"dimension": "Repro.day", "granularity": "day"}],
 "order": {"Repro.day": "asc"}}

Expected: 2026-01-01 = 308.25, 2026-01-02 = 917.25, … This is computed from the generated rows, and it is also what Cube returns once "dateRange": ["2026-01-01", "2026-03-01"] is added.

Actual without dateRange: 2026-01-01 = 917.25, 2026-01-02 = 1827, …

  • 59 of the 60 returned values equal the expected value of the next day.
  • All 60 values are wrong.
  • With dateRange, 0 of 60 are wrong.

On a real data set we also saw the no-dateRange series end about three weeks before the last data date, while the dateRange query covered the full range. We could not isolate that part synthetically.

Expected behavior Either the same values as with an explicit dateRange, or an error as in 1.6.x.

Minimally reproducible Cube Schema

yaml
cubes:
  - name: Repro
    sql: >
      SELECT DATEADD(day, a.d + 10 * b.d, CAST('2026-01-01' AS date)) AS day,
             s.store AS store,
             CAST(100.25 * (a.d + 10 * b.d + 1) + s.k AS DECIMAL(18, 5)) AS amount
      FROM (VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9)) AS a(d)
      CROSS JOIN (VALUES (0),(1),(2),(3),(4),(5)) AS b(d)
      CROSS JOIN (VALUES ('A', 1.5), ('B', 2.5), ('C', 3.5)) AS s(store, k)
    dimensions:
      - name: day
        sql: day
        type: time
    measures:
      - name: amount_7d
        sql: amount
        type: sum
        rolling_window:
          trailing: 7 day
          offset: end

Version: Cube 1.7.46 (Tesseract SQL planner, default), data source mssql, no query timezone. Regression vs 1.6.69.