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