-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from DW-BI-Project/develop
Develop
- Loading branch information
Showing
1 changed file
with
9 additions
and
2 deletions.
There are no files selected for viewing
11 changes: 9 additions & 2 deletions
11
silverwork_dbt/models/marts/agg/agg_continuous_projects.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
with projects as ( | ||
select * from {{ ref('stg_raw_data__projects') }} | ||
where continuous_project_start_year IS NOT NULL | ||
and continuous_project_start_year not in ('nan' , 'None') | ||
and end_date >= start_date | ||
), | ||
|
||
filter as( | ||
{% if target.type == 'snowflake' %} | ||
select * | ||
, year - continuous_project_start_year AS duration_years | ||
from projects | ||
where continuous_project_start_year IS NOT NULL | ||
and start_date - end_date >= 0 | ||
{% else %} | ||
select year , continuous_project_start_year | ||
, CAST(year AS int) - CAST(continuous_project_start_year AS int) AS duration_years | ||
from projects | ||
{% endif %} | ||
) | ||
select * from filter |