Files
ISSSTELEON/Persistance/dbt/models/gold/cacu/cacu_cohort_total.sql
T
Roberto Treviño b9ed108855 ISSSTELEON 8a7974a
2026-11-29 18:09:05 -06:00

12 lines
361 B
SQL

with ranked as (
select
person_id, date,
row_number() over (partition by person_id order by date, source_table, source_id) as n
from {{ ref('cacu_events') }}
where date <= {{ as_of() }} and source_table <> 'person'
)
select person_id, date as index_date, cast(null as {{ dbt.type_string() }}) as excluded_by
from ranked
where n = 1