TrainityTrainity
All ideas

solve my sql query and provide me right method of doing it

I want to make another colum named as g which shows growth percent as ((cumulativeusers- count(distinct userid))/cumulative_users)*100 but there is an error define that cumulative_user is not defined plss provide the right solution of doing it pls provide me the right query and tell me what is the problem aslo and what is my mistake i will appericiate ur help thanks screenshot of the problem is attached also here is the query: select year , weeknum , numusers , sum(numusers) over (order by year , weeknum rows between unbounded preceding and current row) as cumulative_users, ((cumulativeusers- count(distinct userid))/cumulative_users)*100 as g from ( select extract(year from createdat) as year , extract(week from createdat) as weeknum , count(distinct userid) as numusers from users group by year , weeknum order by year, weeknum desc ) a