Skip to main content

Use case

Sometimes, you might need to group the result set by units of time that are different from default granularities such as week (starting on Monday) or year (starting on January 1). Below, we explore the following examples of custom granularities:
  • Week starting on Sunday, commonly used in the US and some other countries.
  • Fiscal year and fiscal quarter, commonly used in accounting and financial reporting.

Data modeling

Consider the following data model. interval and offset parameters are used to configure each custom granularity in granularities. Note that custom granularities are also exposed via proxy dimensions so that we can conveniently query them via Playground or BI tools connected via the SQL API. We can also use them in further calculations like rendering fiscal_quarter_label.

Result

Querying this data modal would yield the following result: