cube-js/cube · error

compareDateRange drillDown query is not currently supported

Error message

compareDateRange drillDown query is not currently supported

What it means

ResultSet.drillDown() builds the underlying detail query for a clicked cell, but drill-down for compareDateRange queries (multiple date ranges compared in one query) has no single unambiguous source query, so the method explicitly refuses and throws. This is a deliberate 'not implemented' guard, not a runtime failure of your data or config.

Source

Thrown at packages/cubejs-client-core/src/ResultSet.ts:202

   * // An example for React
   * const drillDownResponse = useCubeQuery(
   *    {
   *      ...drillDownQuery,
   *      limit: 30,
   *      order: {
   *        'Orders.ts': 'desc'
   *      }
   *    },
   *    {
   *      skip: !drillDownQuery
   *    }
   *  );
   * ```
   * @returns Drill down query
   */
  public drillDown(drillDownLocator: DrillDownLocator, pivotConfig?: PivotConfig): Query | null {
    if (this.queryType === QUERY_TYPE.COMPARE_DATE_RANGE_QUERY) {
      throw new Error('compareDateRange drillDown query is not currently supported');
    }
    if (this.queryType === QUERY_TYPE.BLENDING_QUERY) {
      throw new Error('Data blending drillDown query is not currently supported');
    }

    const { query } = this.loadResponses[0];
    const xValues = drillDownLocator?.xValues ?? [];
    const yValues = drillDownLocator?.yValues ?? [];
    const normalizedPivotConfig = this.normalizePivotConfig(pivotConfig);

    const values: string[][] = [];
    normalizedPivotConfig?.x.forEach((member, currentIndex) => values.push([member, xValues[currentIndex]]));
    normalizedPivotConfig?.y.forEach((member, currentIndex) => values.push([member, yValues[currentIndex]]));

    const { filters: parentFilters = [], segments = [] } = this.query();
    const { measures, timeDimensions: timeDimensionsAnnotation } = this.loadResponses[0].annotation;
    let [, measureName] = values.find(([member]) => member === 'measures') || [];

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Disable/omit the drillDown handler for charts whose query uses compareDateRange.
  2. Restructure the comparison as two separate regular queries (one per date range) so drillDown works on each ResultSet.
  3. Implement the drill-down query manually: derive measure/dimension members from the pivot and apply the specific date-range filter yourself.
  4. Track Cube client releases for compareDateRange drillDown support before relying on it.

Example fix

// before
onClick={() => {
  const q = resultSet.drillDown({ xValues, yValues }); // throws for compareDateRange
  if (q) runDrill(q);
}}

// after
onClick={() => {
  if (resultSet.queryType === 'compareDateRange') return; // skip drill-down
  const q = resultSet.drillDown({ xValues, yValues });
  if (q) runDrill(q);
}}
Defensive patterns

Strategy: validation

Validate before calling

function canDrillDown(resultSet) {
  const unsupported = ['compareDateRange', 'blending'];
  return resultSet && !unsupported.includes(resultSet.queryType);
}

// usage
onClick={() => { if (canDrillDown(resultSet)) { const q = resultSet.drillDown(loc); } }}

Type guard

function isDrillable(rs: ResultSet): boolean {
  return rs.queryType !== 'compareDateRange' && rs.queryType !== 'blending';
}

Try / catch

let drillQuery = null;
try {
  drillQuery = resultSet.drillDown({ xValues, yValues }, pivotConfig);
} catch (e) {
  if (/drillDown query is not currently supported/.test(e.message)) {
    drillQuery = null; // hide drill-down UI for unsupported query types
  } else { throw e; }
}

Prevention

When it happens

Trigger: Calling resultSet.drillDown(locator, pivotConfig) on a ResultSet whose queryType is 'compareDateRange' (returned by the server for a multi-range timeDimension comparison), e.g. the user clicks a chart cell in a period-over-period comparison wired to drillDown.

Common situations: Dashboard libraries that attach drill-down handlers generically to every ResultSet; an app that recently switched a chart from a single date range to compareDateRange without removing the drillDown handler.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/a314453c82891991. Report an issue: GitHub.