Skip to content

Commit 690d32e

Browse files
committed
Added statistics model, updated revenue model
1 parent 38b3ef7 commit 690d32e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{ config(materialized='table') }}
2+
3+
with trips_data as (
4+
select * from {{ ref('fact_trips') }}
5+
)
6+
select
7+
-- Reveneue grouping
8+
pickup_zone as revenue_zone,
9+
date_trunc('month', pickup_datetime) as revenue_month,
10+
--Note: For BQ use instead: date_trunc(pickup_datetime, month) as revenue_month,
11+
12+
service_type,
13+
14+
-- Additional calculations
15+
count(tripid) as total_monthly_trips,
16+
avg(passenger_count) as avg_montly_passenger_count,
17+
avg(trip_distance) as avg_montly_trip_distance
18+
19+
from trips_data
20+
group by 1,2,3
21+

0 commit comments

Comments
 (0)