Skip to content

Commit

Permalink
data mart
Browse files Browse the repository at this point in the history
  • Loading branch information
kzzzr committed Jul 18, 2023
1 parent e636052 commit 61cbab7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion models/marts/f_orders_stats.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,16 @@
)
}}

SELECT 1
SELECT
toYear(O_ORDERDATE) AS O_ORDERYEAR
, O_ORDERSTATUS
, O_ORDERPRIORITY
, count(DISTINCT O_ORDERKEY) AS num_orders
, count(DISTINCT C_CUSTKEY) AS num_customers
, sum(L_EXTENDEDPRICE * L_DISCOUNT) AS revenue
FROM {{ ref('f_lineorder_flat') }} -- PLEASE USE dbt's ref('') to ensure valid DAG execution!
WHERE 1=1
GROUP BY
toYear(O_ORDERDATE)
, O_ORDERSTATUS
, O_ORDERPRIORITY

0 comments on commit 61cbab7

Please sign in to comment.