wip fixing deals from hubspot
This commit is contained in:
parent
cf024f7b71
commit
26898322e7
6 changed files with 136 additions and 213 deletions
|
|
@ -0,0 +1,31 @@
|
|||
with
|
||||
int_kpis__agg_daily_deals as (
|
||||
select date, dimension_value as hubspot_listing_segmentation, new_deals
|
||||
from {{ ref("int_kpis__agg_daily_deals") }}
|
||||
where dimension = 'by_number_of_listings'
|
||||
),
|
||||
number_of_listing_expected_mrr as (
|
||||
select
|
||||
mom.date,
|
||||
mom.dimension,
|
||||
mom.dimension_value,
|
||||
ad.new_deals as number_of_new_deals,
|
||||
mom.expected_mrr_per_deal * ad.new_deals as expected_mrr
|
||||
from {{ ref("int_monthly_onboarding_mrr_per_deal") }} mom
|
||||
left join
|
||||
int_kpis__agg_daily_deals ad
|
||||
on mom.date = ad.date
|
||||
and mom.dimension_value = ad.hubspot_listing_segmentation
|
||||
where mom.dimension = 'by_number_of_listings'
|
||||
)
|
||||
select *
|
||||
from number_of_listing_expected_mrr
|
||||
union all
|
||||
select
|
||||
date,
|
||||
'global' as dimension,
|
||||
'global' as dimension_value,
|
||||
sum(number_of_new_deals) as number_of_new_deals,
|
||||
sum(expected_mrr) as expected_mrr
|
||||
from number_of_listing_expected_mrr
|
||||
group by date
|
||||
Loading…
Add table
Add a link
Reference in a new issue