title: Google big query - Firebase analytics - Closed funnel for screen views (parameters)
body: <p>I would to like get a closed funnel for my X screen views, which are parameters of event <code>screen_view</code></p>
  
  <p>I have found this very good tutorial - <a href="https://medium.com/firebase-developers/how-do-i-create-a-closed-funnel-in-google-analytics-for-firebase-using-bigquery-6eb2645917e1" rel="nofollow noreferrer">https://medium.com/firebase-developers/how-do-i-create-a-closed-funnel-in-google-analytics-for-firebase-using-bigquery-6eb2645917e1</a> but it is only for a closed funnel with events.</p>
  
  <p>I would like to get this:</p>
  
  <pre><code>event_name   event_param    count_users
  screen_view  screen_name_1  100
  screen_view  screen_name_2  50
  screen_view  screen_name_3  20
  screen_view  screen_name_4  5
  </code></pre>
  
  <p>What I have tried is to change the provided code in the tutorial to event params, but I got to the point where I have no idea what to do next.</p>
  
  <pre><code>SELECT *,
  IF (value.string_value = "screen_name1", user_pseudo_id, NULL) as funnel_1, 
  IF (value.string_value = "screen_name1" AND next_event = "screen_name2", user_pseudo_id, NULL) AS funnel_2
  FROM (
    SELECT p.value.string_value, user_pseudo_id , event_timestamp,
    LEAD(p.value.string_value, 1) OVER (PARTITION BY user_pseudo_id ORDER BY event_timestamp) AS next_event
    FROM `ProjectName.analytics_XX.events_20190119` as t1, UNNEST(event_params) as p
    WHERE (p.value.string_value = "screen_name1" OR p.value.string_value = "screen_name2")
    ORDER BY 2,3
    LIMIT 100
  )
  </code></pre>
  
  <p>Thanks for any help!</p>