Skip to content

Commit a38f6ce

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

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

models/core/dm_monthly_zone_revenue.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ with trips_data as (
2323
sum(congestion_surcharge) as revenue_monthly_congestion_surcharge,
2424

2525
-- Additional calculations
26-
count(tripid) as total_monthly_trips,
27-
avg(passenger_count) as avg_montly_passenger_count,
28-
avg(trip_distance) as avg_montly_trip_distance
26+
-- count(tripid) as total_monthly_trips,
27+
-- avg(passenger_count) as avg_montly_passenger_count,
28+
-- avg(trip_distance) as avg_montly_trip_distance
2929

3030
from trips_data
3131
group by 1,2,3
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)