Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I have two CTE's: with screen as ( ( SELECT user _ _ pseudo _ _ id as user _ _ id , , geo.country
I have two CTE's:
with screen as
(
SELECT
user_pseudo_id as user_id,
geo.country as country,
event_timestamp,
CASE
WHEN params1.value.string_value = 'Duas' or params1.value.string_value = 'DuasTopics' THEN 'Duas'
WHEN params1.value.string_value = 'Explore' or params1.value.string_value = 'Topic' THEN 'Explore by Topic'
ELSE params1.value.string_value
END AS screen_name,
FROM
`table` AS base,
UNNEST(event_params) AS params1
WHERE
event_name = 'screen_view'
AND params1.key = 'firebase_screen'
AND event_date between ' 2 0 2 3 1 0 0 1 ' " id="MathJax-Element-35-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">'20231001' and ' 2 0 2 3 1 2 3 1 ' " id="MathJax-Element-36-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">'20231231'
)
,
remove AS (
SELECT
distinct user_pseudo_id
FROM
`table`
where event_name='app_remove'
AND event_date between ' 2 0 2 3 1 0 0 1 ' " id="MathJax-Element-48-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">'20231001' and ' 2 0 2 3 1 2 3 1 ' " id="MathJax-Element-49-Frame" role="presentation" style="font-size: 121%; position: relative;" tabindex="0">'20231231'
)
I want to find out the top 10 countries where screen_name 'settings' was the last screen viewed before app removal, along with the % of associated users.
For example Malaysia has 70% users who viewed 'settings' before removing the app.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Heres the SQL query to find the top 10 countries where settings was the last screen viewed before ap...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started