Skip to content

Commit

Permalink
custom grain
Browse files Browse the repository at this point in the history
  • Loading branch information
Jstein77 committed Sep 26, 2024
1 parent ca44c6b commit 3132267
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion models/marts/_models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
granularity: day # set granularity at column-level for standard_granularity_column
- name: fiscal_quarter
3 changes: 2 additions & 1 deletion models/marts/time_spine.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 3132267

Please sign in to comment.