-
Notifications
You must be signed in to change notification settings - Fork 941
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: 2 | ||
|
||
exposures: | ||
- name: fnl_sales_newcustomersmonthly | ||
label: fnl_sales_newcustomersmonthly | ||
description: Inksacio data app with dashboard showing the total number of new customers per month | ||
type: dashboard | ||
url: https://inksacio.eks.octopus.engineering/my_certification_dashboard/ | ||
owner: | ||
email: [email protected] | ||
depends_on: | ||
- ref('fnl_sales_newcustomersmonthly') |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: fnl_finance_newcustomersmonthly | ||
access: public | ||
config: | ||
group: industry_operations | ||
meta: | ||
owner: [email protected] | ||
description: | | ||
This model contains one row per month and the total number of customers making their first order in that month. | ||
columns: | ||
- name: first_order_month | ||
tests: | ||
- unique | ||
- not_null |
8 changes: 8 additions & 0 deletions
8
jaffle_shop/models/final/sales/fnl_sales_newcustomersmonthly.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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
SELECT | ||
DATE_TRUNC('month', first_order) AS first_order_month | ||
-- No need to use count distinct here, as wh_customers has one row per customer | ||
, COUNT(customer_id) AS new_customers | ||
|
||
FROM {{ ref('wh_customers') }} AS customers | ||
|
||
GROUP BY DATE_TRUNC('month', first_order) |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
version: 2 | ||
|
||
exposures: | ||
- name: fnl_finance_customerreturns | ||
label: fnl_finance_customerreturns | ||
description: Inksacio data app with dashboard for dbt certification | ||
type: dashboard | ||
url: https://inksacio.eks.octopus.engineering/my_certification_dashboard/ | ||
owner: | ||
email: [email protected] | ||
depends_on: | ||
- ref('fnl_finance_returns_by_customer') | ||
- name: fnl_sales_newcustomers | ||
label: fnl_sales_newcustomers | ||
description: Inksacio data app with dashboard for dbt certification | ||
type: dashboard | ||
url: https://inksacio.eks.octopus.engineering/my_certification_dashboard/ | ||
owner: | ||
email: [email protected] | ||
depends_on: | ||
- ref('fnl_sales_newcustomers') |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: fnl_finance_customerreturns | ||
access: public | ||
config: | ||
group: industry_operations | ||
meta: | ||
owner: [email protected] | ||
description: | | ||
This model contains one row per customer and the total financial value of their returned orders. | ||
columns: | ||
- name: customer_id | ||
tests: | ||
- unique | ||
- not_null |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
SELECT | ||
customer_id | ||
, SUM(amount) AS total_amount_returned | ||
|
||
FROM {{ ref('wh_orders') }} | ||
|
||
WHERE status = 'returned' | ||
|
||
GROUP BY customer_id |