Analyticsintermediate

Time Series Functions: AGO, TODATE, PERIODROLLING

Explain OBIEE's built-in time-series calculation functions and how they depend on a properly modeled Time hierarchy.

Time-based comparisons — year-over-year growth, month-to-date totals, rolling averages — are among the most commonly requested calculations in any BI tool, and OBIEE provides dedicated functions specifically because writing this logic manually in SQL for every report would be repetitive and error-prone. Interviewers ask about these functions to check both syntax familiarity and, more importantly, whether you understand their dependency on a correctly modeled Time dimension hierarchy.

AGO is like looking up what you weighed exactly one year ago today. TODATE is like your running weight-loss total since January 1st this year. PERIODROLLING is like your trailing 3-month average weight, which slides forward every time a new month's reading comes in, rather than resetting each January.

Key Concepts

1
AGO shifts a measure back by a specified number of periods at a specified hierarchy level — AGO("Sales Facts"."Revenue", "Time"."Fiscal Year", 1) returns revenue from one fiscal year prior, for each row, aligned to the current row's period. TODATE computes a cumulative aggregation from the start of a specified period up to the current row's date — used for month-to-date, quarter-to-date, or year-to-date totals. PERIODROLLING computes a rolling aggregation across a specified window of periods (e.g., a trailing 3-month rolling average), which is subtly different from TODATE because the window slides rather than resetting at period boundaries.
AGOTODATEPERIODROLLINGAGO("Sales Facts"."Revenue", "Time"."Fiscal Year", 1)
2
All three functions require a properly defined Time hierarchy in the BMM (the levels and chronological key discussed in the hierarchies topic) — the function's second argument references a specific level in that hierarchy, and OBIEE uses the hierarchy's ordering to know what "one year ago" or "start of this quarter" actually means. Without a correctly built hierarchy (or with a Time dimension that's just a flat table of dates with no levels), these functions either fail outright or produce nonsensical results.
require a properly defined Time hierarchy
3
A strong interview answer also mentions that these functions generate potentially complex physical SQL (self-joins or window functions depending on the physical database's dialect) and that heavy use of AGO/TODATE across many columns in a single report can meaningfully increase query cost — worth flagging as a performance consideration, not just a syntax exercise.