Documentation Index
Fetch the complete documentation index at: https://cubed3-igor-core-418-duplicate-view-definitions-break-deplo.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Use case
Often, thereβs a need to calculate a period-over-period change in a metric, e.g., week-over-week or month-over-month growth of clicks, orders, revenue, etc.Data modeling
In Cube, calculating a period-over-period metric involves the following steps:- Define a multi-stage measure for the current period.
- Define a time-shift measure that references the current period measure and shifts it to the previous period.
- Define a calculated measure that references these measures and uses them in a calculation, e.g., divides or subtracts them.
current_month_sum is the base measure, previous_month_sum
is a time-shift measure that shifts the current month data to the previous
month, and the month_over_month_ratio measure divides their values:
Result
When querying period-over-period measures, use a time dimension with a granularity that matches the period β e.g.,month for month-over-month calculations: