Merged PR 3420: Remove previous KPIs computation for Bookings, Guest Journeys and Guest Payments
# Description Removes old computation of KPIs of Bookings, Guest Journeys and Guest Payments, after yesterday's switch to new computation. It cleans 1) models 2) schema entries and 3) temporary tests. # Checklist - [X] The edited models and dependants run properly with production data. - [NA] The edited models are sufficiently documented. - [X] The edited models contain PK tests, and I've ran and passed them. **(Except for the duplicated Booking to Product Bundle)** - [X] I have checked for DRY opportunities with other models and docs. - [NA] I've picked the right materialization for the affected models. # Other - [ ] Check if a full-refresh is required after this PR is merged. Remove previous KPIs computation for Bookings, Guest Journeys and Guest Payments Related work items: #23576
This commit is contained in:
parent
f601b69c7d
commit
c21b05f9cf
19 changed files with 0 additions and 1658 deletions
|
|
@ -1,52 +0,0 @@
|
|||
{% set min_date = "2022-01-01" %}
|
||||
{% set dimensions = ("global", "by_billing_country") %}
|
||||
-- "by_number_of_listings" excluded on purpose - there's differences because of daily
|
||||
-- segmentation
|
||||
with
|
||||
new_mtd_billable_bookings as (
|
||||
select end_date as date, dimension, dimension_value, billable_bookings
|
||||
from {{ ref("int_kpis__aggregated_mtd_billable_bookings") }}
|
||||
where
|
||||
end_date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
new_monthly_billable_bookings as (
|
||||
select end_date as date, dimension, dimension_value, billable_bookings
|
||||
from {{ ref("int_kpis__aggregated_monthly_billable_bookings") }}
|
||||
where
|
||||
end_date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
new_billable_bookings as (
|
||||
select *
|
||||
from new_mtd_billable_bookings
|
||||
union all
|
||||
select *
|
||||
from new_monthly_billable_bookings
|
||||
),
|
||||
old_billable_bookings as (
|
||||
select date, dimension, dimension_value, billable_bookings
|
||||
from {{ ref("int_core__mtd_billable_bookings_metric") }}
|
||||
where date >= '{{ min_date }}' and dimension in {{ dimensions }}
|
||||
),
|
||||
comparison as (
|
||||
select
|
||||
coalesce(o.date, n.date) as date,
|
||||
coalesce(o.dimension, n.dimension) as dimension,
|
||||
coalesce(o.dimension_value, n.dimension_value) as dimension_value,
|
||||
o.billable_bookings as old_billable_bookings,
|
||||
n.billable_bookings as new_billable_bookings,
|
||||
coalesce(o.billable_bookings, 0) - coalesce(n.billable_bookings, 0) as diff
|
||||
from old_billable_bookings o
|
||||
full outer join
|
||||
new_billable_bookings n
|
||||
on o.date = n.date
|
||||
and o.dimension = n.dimension
|
||||
and o.dimension_value = n.dimension_value
|
||||
)
|
||||
select *
|
||||
from comparison
|
||||
where diff <> 0
|
||||
order by date desc, abs(diff) desc
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
{% set min_date = "2022-01-01" %}
|
||||
{% set dimensions = ("global", "by_billing_country") %}
|
||||
-- "by_number_of_listings" excluded on purpose - there's differences because of daily
|
||||
-- segmentation
|
||||
with
|
||||
new_mtd_cancelled_bookings as (
|
||||
select end_date as date, dimension, dimension_value, cancelled_bookings
|
||||
from {{ ref("int_kpis__aggregated_mtd_cancelled_bookings") }}
|
||||
where
|
||||
end_date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
new_monthly_cancelled_bookings as (
|
||||
select end_date as date, dimension, dimension_value, cancelled_bookings
|
||||
from {{ ref("int_kpis__aggregated_monthly_cancelled_bookings") }}
|
||||
where
|
||||
end_date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
new_cancelled_bookings as (
|
||||
select *
|
||||
from new_mtd_cancelled_bookings
|
||||
union all
|
||||
select *
|
||||
from new_monthly_cancelled_bookings
|
||||
),
|
||||
old_cancelled_bookings as (
|
||||
select date, dimension, dimension_value, cancelled_bookings
|
||||
from {{ ref("int_core__mtd_cancelled_bookings_metric") }}
|
||||
where date >= '{{ min_date }}' and dimension in {{ dimensions }}
|
||||
),
|
||||
comparison as (
|
||||
select
|
||||
coalesce(o.date, n.date) as date,
|
||||
coalesce(o.dimension, n.dimension) as dimension,
|
||||
coalesce(o.dimension_value, n.dimension_value) as dimension_value,
|
||||
o.cancelled_bookings as old_cancelled_bookings,
|
||||
n.cancelled_bookings as new_cancelled_bookings,
|
||||
coalesce(o.cancelled_bookings, 0)
|
||||
- coalesce(n.cancelled_bookings, 0) as diff
|
||||
from old_cancelled_bookings o
|
||||
full outer join
|
||||
new_cancelled_bookings n
|
||||
on o.date = n.date
|
||||
and o.dimension = n.dimension
|
||||
and o.dimension_value = n.dimension_value
|
||||
)
|
||||
select *
|
||||
from comparison
|
||||
where diff <> 0
|
||||
order by date desc, abs(diff) desc
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
{% set min_date = "2022-01-01" %}
|
||||
{% set dimensions = ("global", "by_billing_country") %}
|
||||
-- "by_number_of_listings" excluded on purpose - there's differences because of daily
|
||||
-- segmentation
|
||||
with
|
||||
new_mtd_check_out_bookings as (
|
||||
select end_date as date, dimension, dimension_value, check_out_bookings
|
||||
from {{ ref("int_kpis__aggregated_mtd_check_out_bookings") }}
|
||||
where
|
||||
end_date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
new_monthly_check_out_bookings as (
|
||||
select end_date as date, dimension, dimension_value, check_out_bookings
|
||||
from {{ ref("int_kpis__aggregated_monthly_check_out_bookings") }}
|
||||
where
|
||||
end_date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
new_check_out_bookings as (
|
||||
select *
|
||||
from new_mtd_check_out_bookings
|
||||
union all
|
||||
select *
|
||||
from new_monthly_check_out_bookings
|
||||
),
|
||||
old_check_out_bookings as (
|
||||
select date, dimension, dimension_value, check_out_bookings
|
||||
from {{ ref("int_core__mtd_check_out_bookings_metric") }}
|
||||
where date >= '{{ min_date }}' and dimension in {{ dimensions }}
|
||||
),
|
||||
comparison as (
|
||||
select
|
||||
coalesce(o.date, n.date) as date,
|
||||
coalesce(o.dimension, n.dimension) as dimension,
|
||||
coalesce(o.dimension_value, n.dimension_value) as dimension_value,
|
||||
o.check_out_bookings as old_check_out_bookings,
|
||||
n.check_out_bookings as new_check_out_bookings,
|
||||
coalesce(o.check_out_bookings, 0)
|
||||
- coalesce(n.check_out_bookings, 0) as diff
|
||||
from old_check_out_bookings o
|
||||
full outer join
|
||||
new_check_out_bookings n
|
||||
on o.date = n.date
|
||||
and o.dimension = n.dimension
|
||||
and o.dimension_value = n.dimension_value
|
||||
)
|
||||
select *
|
||||
from comparison
|
||||
where diff <> 0
|
||||
order by date desc, abs(diff) desc
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
{% set min_date = "2022-01-01" %}
|
||||
{% set dimensions = ("global", "by_billing_country") %}
|
||||
-- "by_number_of_listings" excluded on purpose - there's differences because of daily
|
||||
-- segmentation
|
||||
with
|
||||
new_mtd_completed_guest_journeys as (
|
||||
select end_date as date, dimension, dimension_value, completed_guest_journeys
|
||||
from {{ ref("int_kpis__aggregated_mtd_completed_guest_journeys") }}
|
||||
where
|
||||
end_date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
new_monthly_completed_guest_journeys as (
|
||||
select end_date as date, dimension, dimension_value, completed_guest_journeys
|
||||
from {{ ref("int_kpis__aggregated_monthly_completed_guest_journeys") }}
|
||||
where
|
||||
end_date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
new_completed_guest_journeys as (
|
||||
select *
|
||||
from new_mtd_completed_guest_journeys
|
||||
union all
|
||||
select *
|
||||
from new_monthly_completed_guest_journeys
|
||||
),
|
||||
old_completed_guest_journeys as (
|
||||
select date, dimension, dimension_value, completed_guest_journeys
|
||||
from {{ ref("int_core__mtd_guest_journey_metrics") }}
|
||||
where date >= '{{ min_date }}' and dimension in {{ dimensions }}
|
||||
),
|
||||
comparison as (
|
||||
select
|
||||
coalesce(o.date, n.date) as date,
|
||||
coalesce(o.dimension, n.dimension) as dimension,
|
||||
coalesce(o.dimension_value, n.dimension_value) as dimension_value,
|
||||
o.completed_guest_journeys as old_completed_guest_journeys,
|
||||
n.completed_guest_journeys as new_completed_guest_journeys,
|
||||
coalesce(o.completed_guest_journeys, 0)
|
||||
- coalesce(n.completed_guest_journeys, 0) as diff
|
||||
from old_completed_guest_journeys o
|
||||
full outer join
|
||||
new_completed_guest_journeys n
|
||||
on o.date = n.date
|
||||
and o.dimension = n.dimension
|
||||
and o.dimension_value = n.dimension_value
|
||||
)
|
||||
select *
|
||||
from comparison
|
||||
where diff <> 0
|
||||
order by date desc, abs(diff) desc
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
{% set min_date = "2022-01-01" %}
|
||||
{% set dimensions = ("global", "by_billing_country") %}
|
||||
-- "by_number_of_listings" excluded on purpose - there's differences because of daily
|
||||
-- segmentation
|
||||
with
|
||||
new_mtd_created_bookings as (
|
||||
select end_date as date, dimension, dimension_value, created_bookings
|
||||
from {{ ref("int_kpis__aggregated_mtd_created_bookings") }}
|
||||
where
|
||||
end_date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
new_monthly_created_bookings as (
|
||||
select end_date as date, dimension, dimension_value, created_bookings
|
||||
from {{ ref("int_kpis__aggregated_monthly_created_bookings") }}
|
||||
where
|
||||
end_date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
new_created_bookings as (
|
||||
select *
|
||||
from new_mtd_created_bookings
|
||||
union all
|
||||
select *
|
||||
from new_monthly_created_bookings
|
||||
),
|
||||
old_created_bookings as (
|
||||
select date, dimension, dimension_value, created_bookings
|
||||
from {{ ref("int_core__mtd_created_bookings_metric") }}
|
||||
where date >= '{{ min_date }}' and dimension in {{ dimensions }}
|
||||
),
|
||||
comparison as (
|
||||
select
|
||||
coalesce(o.date, n.date) as date,
|
||||
coalesce(o.dimension, n.dimension) as dimension,
|
||||
coalesce(o.dimension_value, n.dimension_value) as dimension_value,
|
||||
o.created_bookings as old_created_bookings,
|
||||
n.created_bookings as new_created_bookings,
|
||||
coalesce(o.created_bookings, 0) - coalesce(n.created_bookings, 0) as diff
|
||||
from old_created_bookings o
|
||||
full outer join
|
||||
new_created_bookings n
|
||||
on o.date = n.date
|
||||
and o.dimension = n.dimension
|
||||
and o.dimension_value = n.dimension_value
|
||||
)
|
||||
select *
|
||||
from comparison
|
||||
where diff <> 0
|
||||
order by date desc, abs(diff) desc
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
{% set min_date = "2022-01-01" %}
|
||||
{% set dimensions = ("global", "by_billing_country") %}
|
||||
-- "by_number_of_listings" excluded on purpose - there's differences because of daily
|
||||
-- segmentation
|
||||
with
|
||||
new_mtd_created_guest_journeys as (
|
||||
select end_date as date, dimension, dimension_value, created_guest_journeys
|
||||
from {{ ref("int_kpis__aggregated_mtd_created_guest_journeys") }}
|
||||
where
|
||||
end_date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
new_monthly_created_guest_journeys as (
|
||||
select end_date as date, dimension, dimension_value, created_guest_journeys
|
||||
from {{ ref("int_kpis__aggregated_monthly_created_guest_journeys") }}
|
||||
where
|
||||
end_date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
new_created_guest_journeys as (
|
||||
select *
|
||||
from new_mtd_created_guest_journeys
|
||||
union all
|
||||
select *
|
||||
from new_monthly_created_guest_journeys
|
||||
),
|
||||
old_created_guest_journeys as (
|
||||
select date, dimension, dimension_value, created_guest_journeys
|
||||
from {{ ref("int_core__mtd_guest_journey_metrics") }}
|
||||
where date >= '{{ min_date }}' and dimension in {{ dimensions }}
|
||||
),
|
||||
comparison as (
|
||||
select
|
||||
coalesce(o.date, n.date) as date,
|
||||
coalesce(o.dimension, n.dimension) as dimension,
|
||||
coalesce(o.dimension_value, n.dimension_value) as dimension_value,
|
||||
o.created_guest_journeys as old_created_guest_journeys,
|
||||
n.created_guest_journeys as new_created_guest_journeys,
|
||||
coalesce(o.created_guest_journeys, 0)
|
||||
- coalesce(n.created_guest_journeys, 0) as diff
|
||||
from old_created_guest_journeys o
|
||||
full outer join
|
||||
new_created_guest_journeys n
|
||||
on o.date = n.date
|
||||
and o.dimension = n.dimension
|
||||
and o.dimension_value = n.dimension_value
|
||||
)
|
||||
select *
|
||||
from comparison
|
||||
where diff <> 0
|
||||
order by date desc, abs(diff) desc
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
{% set min_date = "2022-01-01" %}
|
||||
{% set dimensions = ("global", "by_billing_country") %}
|
||||
-- "by_number_of_listings" excluded on purpose - there's differences because of daily
|
||||
-- segmentation
|
||||
with
|
||||
new_mtd_guest_journeys_with_payment as (
|
||||
select end_date as date, dimension, dimension_value, guest_journeys_with_payment
|
||||
from {{ ref("int_kpis__aggregated_mtd_guest_journeys_with_payment") }}
|
||||
where
|
||||
end_date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
new_monthly_guest_journeys_with_payment as (
|
||||
select end_date as date, dimension, dimension_value, guest_journeys_with_payment
|
||||
from {{ ref("int_kpis__aggregated_monthly_guest_journeys_with_payment") }}
|
||||
where
|
||||
end_date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
new_guest_journeys_with_payment as (
|
||||
select *
|
||||
from new_mtd_guest_journeys_with_payment
|
||||
union all
|
||||
select *
|
||||
from new_monthly_guest_journeys_with_payment
|
||||
),
|
||||
old_guest_journeys_with_payment as (
|
||||
select
|
||||
date,
|
||||
dimension,
|
||||
dimension_value,
|
||||
paid_guest_journeys as guest_journeys_with_payment
|
||||
from {{ ref("int_core__mtd_guest_journey_metrics") }}
|
||||
where date >= '{{ min_date }}' and dimension in {{ dimensions }}
|
||||
),
|
||||
comparison as (
|
||||
select
|
||||
coalesce(o.date, n.date) as date,
|
||||
coalesce(o.dimension, n.dimension) as dimension,
|
||||
coalesce(o.dimension_value, n.dimension_value) as dimension_value,
|
||||
o.guest_journeys_with_payment as old_guest_journeys_with_payment,
|
||||
n.guest_journeys_with_payment as new_guest_journeys_with_payment,
|
||||
coalesce(o.guest_journeys_with_payment, 0)
|
||||
- coalesce(n.guest_journeys_with_payment, 0) as diff
|
||||
from old_guest_journeys_with_payment o
|
||||
full outer join
|
||||
new_guest_journeys_with_payment n
|
||||
on o.date = n.date
|
||||
and o.dimension = n.dimension
|
||||
and o.dimension_value = n.dimension_value
|
||||
)
|
||||
select *
|
||||
from comparison
|
||||
where diff <> 0
|
||||
order by date desc, abs(diff) desc
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
{% set min_date = "2022-01-01" %}
|
||||
{% set dimensions = ("global", "by_billing_country") %}
|
||||
-- "by_number_of_listings" excluded on purpose - there's differences because of daily
|
||||
-- segmentation
|
||||
with
|
||||
new_mtd_guest_payments as (
|
||||
select
|
||||
end_date as date,
|
||||
dimension,
|
||||
dimension_value,
|
||||
deposit_fees_in_gbp,
|
||||
waiver_payments_in_gbp,
|
||||
checkin_cover_fees_in_gbp,
|
||||
total_guest_payments_in_gbp
|
||||
from {{ ref("int_kpis__aggregated_mtd_guest_payments") }}
|
||||
where
|
||||
end_date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
new_monthly_guest_payments as (
|
||||
select
|
||||
end_date as date,
|
||||
dimension,
|
||||
dimension_value,
|
||||
deposit_fees_in_gbp,
|
||||
waiver_payments_in_gbp,
|
||||
checkin_cover_fees_in_gbp,
|
||||
total_guest_payments_in_gbp
|
||||
from {{ ref("int_kpis__aggregated_monthly_guest_payments") }}
|
||||
where
|
||||
end_date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
new_guest_payments as (
|
||||
select *
|
||||
from new_mtd_guest_payments
|
||||
union all
|
||||
select *
|
||||
from new_monthly_guest_payments
|
||||
),
|
||||
old_guest_payments as (
|
||||
select
|
||||
date,
|
||||
dimension,
|
||||
dimension_value,
|
||||
deposit_fees_in_gbp,
|
||||
waiver_payments_in_gbp,
|
||||
checkin_cover_fees_in_gbp,
|
||||
total_guest_payments_in_gbp
|
||||
from {{ ref("int_core__mtd_guest_payments_metrics") }}
|
||||
where date >= '{{ min_date }}' and dimension in {{ dimensions }}
|
||||
),
|
||||
comparison as (
|
||||
select
|
||||
coalesce(o.date, n.date) as date,
|
||||
coalesce(o.dimension, n.dimension) as dimension,
|
||||
coalesce(o.dimension_value, n.dimension_value) as dimension_value,
|
||||
o.deposit_fees_in_gbp as old_deposit_fees_in_gbp,
|
||||
n.deposit_fees_in_gbp as new_deposit_fees_in_gbp,
|
||||
coalesce(o.deposit_fees_in_gbp, 0)
|
||||
- coalesce(n.deposit_fees_in_gbp, 0) as diff_deposit_fees_in_gbp,
|
||||
o.waiver_payments_in_gbp as old_waiver_payments_in_gbp,
|
||||
n.waiver_payments_in_gbp as new_waiver_payments_in_gbp,
|
||||
coalesce(o.waiver_payments_in_gbp, 0)
|
||||
- coalesce(n.waiver_payments_in_gbp, 0) as diff_waiver_payments_in_gbp,
|
||||
o.checkin_cover_fees_in_gbp as old_checkin_cover_fees_in_gbp,
|
||||
n.checkin_cover_fees_in_gbp as new_checkin_cover_fees_in_gbp,
|
||||
coalesce(o.checkin_cover_fees_in_gbp, 0) - coalesce(
|
||||
n.checkin_cover_fees_in_gbp, 0
|
||||
) as diff_checkin_cover_fees_in_gbp,
|
||||
o.total_guest_payments_in_gbp as old_total_guest_payments_in_gbp,
|
||||
n.total_guest_payments_in_gbp as new_total_guest_payments_in_gbp,
|
||||
coalesce(o.total_guest_payments_in_gbp, 0) - coalesce(
|
||||
n.total_guest_payments_in_gbp, 0
|
||||
) as diff_total_guest_payments_in_gbp
|
||||
from old_guest_payments o
|
||||
full outer join
|
||||
new_guest_payments n
|
||||
on o.date = n.date
|
||||
and o.dimension = n.dimension
|
||||
and o.dimension_value = n.dimension_value
|
||||
)
|
||||
select *
|
||||
from comparison
|
||||
where
|
||||
diff_deposit_fees_in_gbp <> 0
|
||||
or diff_waiver_payments_in_gbp <> 0
|
||||
or diff_checkin_cover_fees_in_gbp <> 0
|
||||
or diff_total_guest_payments_in_gbp <> 0
|
||||
order by date desc, diff_total_guest_payments_in_gbp desc
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
{% set min_date = "2022-01-01" %}
|
||||
{% set dimensions = ("global", "by_billing_country") %}
|
||||
-- "by_number_of_listings" excluded on purpose - there's differences because of daily
|
||||
-- segmentation
|
||||
with
|
||||
new_mtd_started_guest_journeys as (
|
||||
select end_date as date, dimension, dimension_value, started_guest_journeys
|
||||
from {{ ref("int_kpis__aggregated_mtd_started_guest_journeys") }}
|
||||
where
|
||||
end_date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
new_monthly_started_guest_journeys as (
|
||||
select end_date as date, dimension, dimension_value, started_guest_journeys
|
||||
from {{ ref("int_kpis__aggregated_monthly_started_guest_journeys") }}
|
||||
where
|
||||
end_date >= '{{ min_date }}'
|
||||
and dimension in {{ dimensions }}
|
||||
and dimension_value <> 'UNSET'
|
||||
),
|
||||
new_started_guest_journeys as (
|
||||
select *
|
||||
from new_mtd_started_guest_journeys
|
||||
union all
|
||||
select *
|
||||
from new_monthly_started_guest_journeys
|
||||
),
|
||||
old_started_guest_journeys as (
|
||||
select date, dimension, dimension_value, started_guest_journeys
|
||||
from {{ ref("int_core__mtd_guest_journey_metrics") }}
|
||||
where date >= '{{ min_date }}' and dimension in {{ dimensions }}
|
||||
),
|
||||
comparison as (
|
||||
select
|
||||
coalesce(o.date, n.date) as date,
|
||||
coalesce(o.dimension, n.dimension) as dimension,
|
||||
coalesce(o.dimension_value, n.dimension_value) as dimension_value,
|
||||
o.started_guest_journeys as old_started_guest_journeys,
|
||||
n.started_guest_journeys as new_started_guest_journeys,
|
||||
coalesce(o.started_guest_journeys, 0)
|
||||
- coalesce(n.started_guest_journeys, 0) as diff
|
||||
from old_started_guest_journeys o
|
||||
full outer join
|
||||
new_started_guest_journeys n
|
||||
on o.date = n.date
|
||||
and o.dimension = n.dimension
|
||||
and o.dimension_value = n.dimension_value
|
||||
)
|
||||
select *
|
||||
from comparison
|
||||
where diff <> 0
|
||||
order by date desc, abs(diff) desc
|
||||
Loading…
Add table
Add a link
Reference in a new issue