mysql - Customer Retention Query - Help needed -
i having table named users. trying calculate daily retention rate. field of users table :-
id || email|| current_sign_in_at || last_sign_in_at || sign_in_count
i trying calculate number of users retaining in past 24 hours. (definition of retained user - user has sign in count =2 within last 24 hours) so, query this
select count(*), date(last_sign_in_at) users last_sign_in_at between '2015-09-30' , '2015-10-22' , sign_in_count = '2' group date(last_sign_in_at)
gives me results in following way
count(*) || date(last_sign_in_at)
659 01/10/2015 492 02/10/2015 360 03/10/2015 421 04/10/2015 535 05/10/2015 641 06/10/2015 657 07/10/2015
so, ideally let's on 2nd 492 users users retained out of 659 users first day. till 4th day fine, increases doesn't make sense. doing wrong here? primary objective calculate users have logged in twice in 24 hours time period. so, can make out if x users logged in 1 day , y users out of x users logged in day i.e. y% of x users retaining.
Comments
Post a Comment