Skip to content

DateShift

Time intelligenceCalculate modifier

DateShift(dateCol, n, unit)

A modifier for Calculate: evaluates the measure over data shifted by n units of "day" | "week" | "month" | "quarter" | "year" (negative = past), while the chart’s date buckets stay put — each bucket shows the shifted period’s value. Date predicates in the same Calculate pin the output buckets and are not shifted.

Computed in-database with a shifted join, correct at every grain including weeks.

  • Year-over-year, quarter-over-quarter, month-over-month — the [Revenue] / [RevenueLY] / growth-% trio.
  • Any shifted baseline: same week last year for seasonality, prior month for run-rate checks.
RevenueLY := Calculate([Revenue], DateShift(Date.Date, -1, "year"))
// Year-over-year growth
YoYGrowth := Divide([Revenue] - [RevenueLY], [RevenueLY])

The sibling CTE groups last year’s rows by their date displaced forward one year, so they join back onto this year’s buckets:

// On a line chart by month
RevenueLY := Calculate([Revenue], DateShift(Date.Date, -1, "year"))

Week grains stay correct because the shift happens on the raw date before bucketing — no ISO-week-boundary drift.

  • Unlike YTD/RollingSum, DateShift composes with any measure — it shifts context rather than accumulating.