Skip to content

Helpers for time dimensions

Márcio Porto edited this page Feb 11, 2020 · 1 revision

Tesseract supports cuts on time values using the syntax time=<time_depth>.latest or time=<time_depth>.oldest. Accepted time depths include:

  • year for levels named "Year"
  • quarter for levels named "Quarter"
  • month for levels named "Month"
  • week for levels named "Week"
  • day for levels named "Day"

To allow a single cut on the most recent "time", it is recommended to add a Time level with a unique identifier for a given time. For example, a dimension table for a cube at the month level could look something like this:

year month time
2019 12 201912
2020 01 202001
2020 02 202002

By doing so, a single cut on time=time.latest will return the data at the most recent year + month combination (in this case, February 2020). Here's what a level definition would look like for this table:

<Level name="Time" key_column="time" />

The time column in this example can be of any type, as long as the composite ID is in descending order. For example, 202001 is the "latest" time compared to 201912 as it's in 2020. But if the order of the composite ID changed to 122019 and 012020, the former would become the latest time based on the way that the ordering works inside Tesseract.

This functionality might be revisited in the future to simplify usage.

Clone this wiki locally