title: How to calculate Session and Session duration in Firebase Analytics raw data?
body: <p>How to calculate <em>Session Duration</em> in Firebase analytics <em>raw data</em> which is linked to BigQuery?</p>
  
  <p>I have used the following blog to calculate the users by using the flatten command for the events which are nested within each record, but I would like to know how to proceed with in calculating the <strong>Session</strong> and <strong>Session duration</strong> by country and time. </p>
  
  <p><em>(I have many apps configured, but if you could help me with the SQL query for calculating the session duration and session, It would be of immense help)</em></p>
  
  <p><a href="https://cloudplatform.googleblog.com/2016/09/using-BigQuery-and-Firebase-Analytics-to-understand-your-mobile-app.html" rel="noreferrer">Google Blog on using Firebase and big query</a></p>