- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-25-2026 09:46 PM
Thanks balajij8, that matches what I have been seeing. To close the loop for anyone landing on this thread: the METRIC_VIEW_WINDOW_FUNCTION_ error is expected behavior. Metric views do not accept raw SQL window functions (for example SUM(...) OVER (...)) directly in a measure's expr, and as balajij8 notes, you also cannot nest one window measure inside another, since that exceeds the boundaries of how window measures are evaluated.
The supported path is to express the running/trailing/period-over-window: construct on the measure rather than an OVER() clause. You keep a plain aggregate in expr and describe the frame separately:
measures:
- name: cumulative_sales
expr: SUM(o_totalprice)
window:
- order: date
range: cumulative
semiadditive: last
range accepts current, cumulative, trailing N day/month, leading N day/month, or all, and offset (for example offset: -12 month) handles year-over-year style comparisons. For the case where you genuinely need a window applied on top of another window result, the workaround is to materialize the inner window measure first (a base metric view or a precomputed table/column) and then define the outer window measure against that, rather than nesting the two in one definition.
Sources: