CREATE OR REPLACE VIEW public.customer_churn AS SELECT sf.year_month, sf.clientaltkey, sf.group_format, sf.region, sf.format, sf.revenue, sf1.year_month_future, sf1.group_format_future FROM segmentation_formats sf LEFT JOIN ( SELECT DISTINCT segmentation_formats.year_month AS year_month_future, segmentation_formats.clientaltkey, segmentation_formats.group_format AS group_format_future FROM segmentation_formats) sf1 ON sf.clientaltkey::text = sf1.clientaltkey::text AND sf.year_month = (sf1.year_month_future - '1 mon'::interval) WHERE sf.year_month >= '2025-01-01'::date;