Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Commit 7e09667

Browse files
committed
Create final models
1 parent e2ad4ec commit 7e09667

6 files changed

Lines changed: 73 additions & 0 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
3+
exposures:
4+
- name: fnl_sales_newcustomersmonthly
5+
label: fnl_sales_newcustomersmonthly
6+
description: Inksacio data app with dashboard showing the total number of new customers per month
7+
type: dashboard
8+
url: https://inksacio.eks.octopus.engineering/my_certification_dashboard/
9+
owner:
10+
email: luke.ralphs-davies@octoenergy.com
11+
depends_on:
12+
- ref('fnl_sales_newcustomersmonthly')
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
3+
models:
4+
- name: fnl_sales_newcustomersmonthly
5+
access: public
6+
config:
7+
group: industry_operations
8+
meta:
9+
owner: luke.ralphs-davies@octoenergy.com
10+
description: |
11+
This model contains one row per month and the total number of customers making their first order in that month.
12+
columns:
13+
- name: first_order_month
14+
tests:
15+
- unique
16+
- not_null
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
SELECT
2+
DATE_TRUNC('month', first_order) AS first_order_month
3+
-- No need to use count distinct here, as wh_customers has one row per customer
4+
, COUNT(customer_id) AS new_customers
5+
6+
FROM {{ ref('wh_customers') }} AS customers
7+
8+
GROUP BY DATE_TRUNC('month', first_order)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
3+
exposures:
4+
- name: fnl_finance_customerreturns
5+
label: fnl_finance_customerreturns
6+
description: Inksacio data app with dashboard showing the financial value of customer returns
7+
type: dashboard
8+
url: https://inksacio.eks.octopus.engineering/my_certification_dashboard/
9+
owner:
10+
email: luke.ralphs-davies@octoenergy.com
11+
depends_on:
12+
- ref('fnl_finance_customerreturns')
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
3+
models:
4+
- name: fnl_finance_customerreturns
5+
access: public
6+
config:
7+
group: industry_operations
8+
meta:
9+
owner: luke.ralphs-davies@octoenergy.com
10+
description: |
11+
This model contains one row per customer and the total financial value of their returned orders.
12+
columns:
13+
- name: customer_id
14+
tests:
15+
- unique
16+
- not_null
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
SELECT
2+
customer_id
3+
, SUM(amount) AS total_amount_returned
4+
5+
FROM {{ ref('wh_orders') }}
6+
7+
WHERE status = 'returned'
8+
9+
GROUP BY customer_id

0 commit comments

Comments
 (0)