diff --git a/models/marts/_models.yml b/models/marts/_models.yml index 7d855c6..9c86054 100644 --- a/models/marts/_models.yml +++ b/models/marts/_models.yml @@ -2,6 +2,9 @@ models: - name: time_spine time_spine: standard_granularity_column: date_day # column for the standard grain of your table + custom_granularities: + - name: fiscal_quarter columns: - name: date_day - granularity: day # set granularity at column-level for standard_granularity_column \ No newline at end of file + granularity: day # set granularity at column-level for standard_granularity_column + - name: fiscal_quarter \ No newline at end of file diff --git a/models/marts/time_spine.sql b/models/marts/time_spine.sql index cb61284..5381fe5 100644 --- a/models/marts/time_spine.sql +++ b/models/marts/time_spine.sql @@ -12,7 +12,8 @@ days as ( cast_to_date as ( select - cast(date_day as date) as date_day + cast(date_day as date) as date_day, + date_trunc('quarter', date_day) as fiscal_quarter from days