How can I Calculate User LTV and find User LifeTime Properties?

While running on the entire date range of the project might be a heavy query that results in a long runtime, we recommend creating a user aggregation using the Materialized View feature that allows you to always have a table available that contains all the latest and most important user fields and calculations.

select internal_user_id, customer_user_id, 
max(case when event_name = 'install' then app_id end) as install_app, 
max(case when event_name = 'install' then event_time_ts end) as install_ts, 
date( min(case when event_name = 'install' then event_time_ts end)) as install_date,
max( case when event_name = 'install' then campaign_name end) as install_campaign,
max(case when event_name = 'install' then media_source end) as install_source, 
max(case when event_name = 'purchase' then event_time_ts end) as last_purchase, 
sum(case when event_name = 'purchase' then 1 else 0 end) as number_of_purchases, 
sum(case when event_name = ''purchase' ' then float(amount) else float(0) end) as ltv,
count(distinct session_id) as sessions, 
max(event_time_ts) as last_seen
from cooladata
where date_range(all)
group by 1,2