SELECT Date1,
COUNT(DISTINCT(CASE WHEN event_name = 'app_signin_onboarding_open' THEN user_type END)) AS onboarding_open,
COUNT(DISTINCT(CASE WHEN event_name = 'app_signin_phone_focus' THEN user_type END)) AS phone_focus,
COUNT(DISTINCT(CASE WHEN event_name ='app_signin_phone_submit' AND ep.value.string_value='success' THEN user_type END)) AS phone_submit_success,
COUNT(DISTINCT(CASE WHEN event_name = 'app_signin_user_type' AND ep.value.string_value='Signup' THEN user_type END)) AS new_users,
COUNT(DISTINCT(CASE WHEN event_name = 'app_signupwithphone_askOTPpage_open' THEN user_type END)) AS new_OTPpage_open,
COUNT(DISTINCT(CASE WHEN event_name = 'app_signupwithphone_otp_submit' AND ep.value.string_value='Succsss' THEN user_type END)) AS new_OTPsubmit_success,
COUNT(DISTINCT(CASE WHEN event_name = 'app_profile_builder_page' THEN user_type END)) AS new_ProfilePage_Open,
COUNT(DISTINCT(CASE WHEN event_name = 'app_profile_submit' AND ep.value.string_value='success' THEN user_type END)) AS new_ProfileSubmit_success,
COUNT(DISTINCT(CASE WHEN event_name = 'app_user_signed_up' THEN user_type END)) AS total_signed_up,
COUNT(DISTINCT(CASE WHEN event_name = 'app_signin_user_type' AND ep.value.string_value='Login' THEN user_type END)) AS old_users,
COUNT(DISTINCT(CASE WHEN event_name = 'app_loginwithphone_askOTPpage_open' THEN user_type END)) AS old_OTPpage_open,
COUNT(DISTINCT(CASE WHEN event_name = 'app_loginwithphone_otp_submit' AND ep.value.string_value='Succsss' THEN user_type END)) AS old_OTPsubmit_success,
COUNT(DISTINCT(CASE WHEN event_name = 'app_user_logged_in' THEN user_type END)) AS total_logged_in
FROM ( SELECT event_date AS Date1,
 user_pseudo_id AS user_type
 FROM `vedantu-fos.analytics_151319189.events_20191204`
WHERE event_name = 'app_signin_onboarding_open' GROUP BY 1,2) A LEFT JOIN `vedantu-fos.analytics_151319189.events_20191204` B ON A.user_type = B.user_pseudo_id, UNNEST(event_params) AS ep GROUP BY 1