Skip to content

Commit

Permalink
Add average by grade model
Browse files Browse the repository at this point in the history
  • Loading branch information
MartyG-BA committed Nov 20, 2024
1 parent 9ee9939 commit 0c55d1c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
20 changes: 20 additions & 0 deletions transform/models/L2_core/martyg_avg_by_grade.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
with raw_source as (

select * from {{ ref('stg_martyg_personal_loans') }}

),

final as (

select
grade,
avg(loan_amnt) as avg_loan_amount,
count(*) as total_loans
from raw_source
where loan_status = 'Fully Paid'
group by grade
order by grade

)

select * from final
9 changes: 9 additions & 0 deletions transform/models/L2_core/martyg_avg_by_grade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2

models:
- name: martyg_avg_by_grade
description: 'Martys model calculating average by grade'
columns:
- name: grade
- name: avg_loan_amount
- name: total_loans

0 comments on commit 0c55d1c

Please sign in to comment.