본문 바로가기

데이터분석캠프 TIL

250228 데이터분석캠프 TIL

1. 회고

오늘 하루 최종플젝을 진행하기 위해, 팀원을 찾으러 다녔다. 포폴 작업을 하느라 거의 다른 것들은 못한 것 같다. 

 

2. QCC

with ranked_events as (select customer_id,
					  event_type,
	                  event_date,
	   case 
	   		when event_type = 'JOIN' THEN 'ACTIVE'
	   		WHEN event_type = 'WITHDRAW' THEN 'INACTIVE'
	   end as status,
	   event_date as start_date,
	   lead(event_date) over (partition by customer_id order by event_date) as next_event
	   from membership_history mh) 
select customer_id,
	   status,
	   start_date,
	   date_sub(next_event, interval 1 day) as end_date,
	   case 
	   		when status = 'ACTIVE' and next_event is null then 1 
	   end as current_flag
from ranked_events
order by customer_id, start_date;

 

'데이터분석캠프 TIL' 카테고리의 다른 글

250306 TIL 데이터분석과정  (0) 2025.03.06
250304 데이터분석캠프 TIL  (0) 2025.03.05
250224 TIL 데이터분석과정  (0) 2025.02.24
250220 데이터 분석 캠프 TIL  (1) 2025.02.20
250219 데이터분석과정 TIL  (0) 2025.02.19