Поправил форму и добавил описание

This commit is contained in:
Aysat
2025-11-26 15:45:18 +06:00
parent 661bf96688
commit 47fa72c757
+24 -16
View File
@@ -16,22 +16,30 @@
''' '''
with monthly_users as ( with monthly_users as (
select count(distinct(user_id)) as active_users, select
date_trunc('month', date) as month count(distinct(user_id)) as active_users,
from abakhytbekuly.users date_trunc('month', date) as month
group by date_trunc('month', date) from
abakhytbekuly.users
group by
date_trunc('month', date)
), ),
change as ( change as (
select active_users, select active_users,
month, month,
lag(active_users) over(order by month) as prev_mau lag(active_users) over(order by month) as prev_mau
from monthly_users from
monthly_users
) )
select active_users, select
month, active_users,
prev_mau, month,
100.0 * (active_users - prev_mau) / prev_mau as pct_change -- тут результат странный типа '-66.666666' prev_mau,
from change 100.0 * (active_users - prev_mau) / prev_mau as pct_change -- тут результат странный типа '-66.666666'
where prev_mau is not null from
order by month change
where
prev_mau is not null
order by
month