Update to listing count in new dash overview
This commit is contained in:
parent
4bef83f432
commit
82829db3d2
6 changed files with 55 additions and 46 deletions
|
|
@ -47,26 +47,35 @@ with
|
|||
count(
|
||||
distinct case
|
||||
when
|
||||
atpb.user_product_bundle_name
|
||||
not in ({{ var("default_service") }})
|
||||
atpb.effective_start_date_utc <= current_date
|
||||
and coalesce(
|
||||
atpb.effective_end_date_utc, {{ var("end_of_time") }}
|
||||
)
|
||||
>= current_date
|
||||
then atpb.id_accommodation
|
||||
else null
|
||||
end
|
||||
) as total_listings_with_product_bundle_with_paid_service,
|
||||
) as total_active_listings_with_active_product_bundle,
|
||||
count(
|
||||
distinct case
|
||||
when
|
||||
atpb.user_product_bundle_name
|
||||
atpb.effective_start_date_utc <= current_date
|
||||
and coalesce(
|
||||
atpb.effective_end_date_utc, {{ var("end_of_time") }}
|
||||
)
|
||||
>= current_date
|
||||
and atpb.user_product_bundle_name
|
||||
not in ({{ var("default_service") }})
|
||||
and atpb.has_no_end_date = true
|
||||
then atpb.id_accommodation
|
||||
else null
|
||||
end
|
||||
) as total_listings_with_active_product_bundle_with_paid_service
|
||||
) as total_active_listings_with_active_product_bundle_with_paid_service
|
||||
from int_core__user_product_bundle upb
|
||||
left join
|
||||
int_core__accommodation_to_product_bundle atpb
|
||||
on upb.id_user_product_bundle = atpb.id_user_product_bundle
|
||||
inner join int_core__accommodation a on upb.id_user_host = a.id_user_host
|
||||
where a.is_active = true
|
||||
group by 1
|
||||
),
|
||||
btpb_aggregation as (
|
||||
|
|
@ -107,8 +116,8 @@ with
|
|||
upb.total_active_user_product_bundles,
|
||||
a.total_listings,
|
||||
a.total_active_listings,
|
||||
atpb.total_listings_with_product_bundle_with_paid_service,
|
||||
atpb.total_listings_with_active_product_bundle_with_paid_service,
|
||||
atpb.total_active_listings_with_active_product_bundle,
|
||||
atpb.total_active_listings_with_active_product_bundle_with_paid_service,
|
||||
btpb.total_bookings_with_product_bundle,
|
||||
btpb.total_bookings_with_product_bundle_with_paid_service
|
||||
from upb_aggregation upb
|
||||
|
|
@ -139,17 +148,17 @@ select
|
|||
total_active_user_product_bundles,
|
||||
total_listings,
|
||||
total_active_listings,
|
||||
total_listings_with_product_bundle_with_paid_service,
|
||||
total_listings_with_active_product_bundle_with_paid_service,
|
||||
total_active_listings_with_active_product_bundle,
|
||||
total_active_listings_with_active_product_bundle_with_paid_service,
|
||||
case when total_active_listings > 0 then 1 else 0 end as has_active_listings,
|
||||
case
|
||||
when total_listings_with_product_bundle_with_paid_service > 0 then 1 else 0
|
||||
end as has_listings_with_paid_service_applied,
|
||||
when total_active_listings_with_active_product_bundle > 0 then 1 else 0
|
||||
end as has_active_listings_with_active_product_bundle_applied,
|
||||
case
|
||||
when total_listings_with_active_product_bundle_with_paid_service > 0
|
||||
when total_active_listings_with_active_product_bundle_with_paid_service > 0
|
||||
then 1
|
||||
else 0
|
||||
end as has_listings_with_active_paid_service_applied,
|
||||
end as has_active_listings_with_active_paid_service_applied,
|
||||
total_bookings_with_product_bundle,
|
||||
total_bookings_with_product_bundle_with_paid_service,
|
||||
case
|
||||
|
|
|
|||
|
|
@ -2639,16 +2639,15 @@ models:
|
|||
activation - not to be confused with activity-based
|
||||
segmentation).
|
||||
|
||||
- name: total_listings_with_product_bundle_with_paid_service
|
||||
- name: total_active_listings_with_active_product_bundle
|
||||
data_type: integer
|
||||
description: |
|
||||
Count of listings that have, or have had, a paid service
|
||||
product bundle activated.
|
||||
Count of active listings that currently have an active product bundle.
|
||||
|
||||
- name: total_listings_with_active_product_bundle_with_paid_service
|
||||
- name: total_active_listings_with_active_product_bundle_with_paid_service
|
||||
data_type: integer
|
||||
description: |
|
||||
Count of listings that currently have an active paid service
|
||||
Count of active listings that currently have an active paid service
|
||||
product bundle.
|
||||
|
||||
- name: has_active_listings
|
||||
|
|
@ -2656,15 +2655,17 @@ models:
|
|||
description: |
|
||||
Integer-based flag version of total_active_listings.
|
||||
|
||||
- name: has_listings_with_paid_service_applied
|
||||
- name: has_active_listings_with_active_product_bundle_applied
|
||||
data_type: integer
|
||||
description: |
|
||||
Integer-based flag version of total_listings_with_product_bundle_with_paid_service.
|
||||
Integer-based flag version of
|
||||
total_active_listings_with_active_product_bundle.
|
||||
|
||||
- name: has_listings_with_active_paid_service_applied
|
||||
- name: has_active_listings_with_active_paid_service_applied
|
||||
data_type: integer
|
||||
description: |
|
||||
Integer-based flag version of total_listings_with_active_product_bundle_with_paid_service.
|
||||
Integer-based flag version of
|
||||
total_active_listings_with_active_product_bundle_with_paid_service.
|
||||
|
||||
- name: total_bookings_with_product_bundle
|
||||
data_type: integer
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
select
|
||||
-- Unique Key --
|
||||
d.first_day_month as start_date,
|
||||
d.date as end_date,
|
||||
d.last_day_month as end_date,
|
||||
{{ dimension.dimension }} as dimension,
|
||||
{{ dimension.dimension_value }} as dimension_value,
|
||||
-- Metrics --
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
left join
|
||||
{{ ref("int_kpis__metric_daily_new_dash_created_bookings") }} as dcb
|
||||
on dcb.date = d.date
|
||||
where d.is_end_of_month = true and dcb.id_booking is not null
|
||||
where dcb.id_booking is not null
|
||||
group by 1, 2, 3, 4
|
||||
{% if not loop.last %}
|
||||
union all
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
select
|
||||
-- Unique Key --
|
||||
d.first_day_month as start_date,
|
||||
d.date as end_date,
|
||||
d.last_day_month as end_date,
|
||||
{{ dimension.dimension }} as dimension,
|
||||
{{ dimension.dimension_value }} as dimension_value,
|
||||
-- Metrics --
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
left join
|
||||
{{ ref("int_kpis__metric_daily_new_dash_created_bookings") }} as dcb
|
||||
on dcb.date = d.date
|
||||
where d.is_end_of_week = true and dcb.id_booking is not null
|
||||
where dcb.id_booking is not null
|
||||
group by 1, 2, 3, 4
|
||||
{% if not loop.last %}
|
||||
union all
|
||||
|
|
|
|||
|
|
@ -20,14 +20,15 @@ select
|
|||
total_active_user_product_bundles as total_active_user_product_bundles,
|
||||
total_listings as total_listings,
|
||||
total_active_listings as total_active_listings,
|
||||
total_listings_with_product_bundle_with_paid_service
|
||||
as total_listings_with_product_bundle_with_paid_service,
|
||||
total_listings_with_active_product_bundle_with_paid_service
|
||||
as total_listings_with_active_product_bundle_with_paid_service,
|
||||
total_active_listings_with_active_product_bundle
|
||||
as total_active_listings_with_active_product_bundle,
|
||||
total_active_listings_with_active_product_bundle_with_paid_service
|
||||
as total_active_listings_with_active_product_bundle_with_paid_service,
|
||||
has_active_listings as has_active_listings,
|
||||
has_listings_with_paid_service_applied as has_listings_with_paid_service_applied,
|
||||
has_listings_with_active_paid_service_applied
|
||||
as has_listings_with_active_paid_service_applied,
|
||||
has_active_listings_with_active_product_bundle_applied
|
||||
as has_active_listings_with_active_product_bundle_applied,
|
||||
has_active_listings_with_active_paid_service_applied
|
||||
as has_active_listings_with_active_paid_service_applied,
|
||||
total_bookings_with_product_bundle as total_bookings_with_product_bundle,
|
||||
total_bookings_with_product_bundle_with_paid_service
|
||||
as total_bookings_with_product_bundle_with_paid_service,
|
||||
|
|
|
|||
|
|
@ -1235,19 +1235,15 @@ models:
|
|||
description: |
|
||||
Count of listings that the user owns.
|
||||
It contains only those that can accept bookings (hard
|
||||
activation - not to be confused with activity-based
|
||||
segmentation).
|
||||
|
||||
- name: total_listings_with_product_bundle_with_paid_service
|
||||
activation - not to be confused with activity-based- name: total_active_listings_with_active_product_bundle
|
||||
data_type: integer
|
||||
description: |
|
||||
Count of listings that have, or have had, a paid service
|
||||
product bundle activated.
|
||||
Count of active listings that currently have an active product bundle.
|
||||
|
||||
- name: total_listings_with_active_product_bundle_with_paid_service
|
||||
- name: total_active_listings_with_active_product_bundle_with_paid_service
|
||||
data_type: integer
|
||||
description: |
|
||||
Count of listings that currently have an active paid service
|
||||
Count of active listings that currently have an active paid service
|
||||
product bundle.
|
||||
|
||||
- name: has_active_listings
|
||||
|
|
@ -1255,15 +1251,17 @@ models:
|
|||
description: |
|
||||
Integer-based flag version of total_active_listings.
|
||||
|
||||
- name: has_listings_with_paid_service_applied
|
||||
- name: has_active_listings_with_active_product_bundle_applied
|
||||
data_type: integer
|
||||
description: |
|
||||
Integer-based flag version of total_listings_with_product_bundle_with_paid_service.
|
||||
Integer-based flag version of
|
||||
total_active_listings_with_active_product_bundle.
|
||||
|
||||
- name: has_listings_with_active_paid_service_applied
|
||||
- name: has_active_listings_with_active_paid_service_applied
|
||||
data_type: integer
|
||||
description: |
|
||||
Integer-based flag version of total_listings_with_active_product_bundle_with_paid_service.
|
||||
Integer-based flag version of
|
||||
total_active_listings_with_active_product_bundle_with_paid_service.
|
||||
|
||||
- name: total_bookings_with_product_bundle
|
||||
data_type: integer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue