Skip to content
Advertisement

Tag: date-difference

How to use date_diff for two adjacent sessions using BigQuery?

I’m trying to calculate average hours between two adjacent sessions using the data from the following table: user_id event_timestamp session_num A 2021-04-16 10:00:00.000 UTC 1 A 2021-04-16 11:00:00.000 UTC 2 A 2021-04-16 13:00:00.000 UTC 3 A 2021-04-16 16:00:00.000 UTC 4 B 2021-04-16 12:00:00.000 UTC 1 B 2021-04-16 14:00:00.000 UTC 2 B 2021-04-16 19:00:00.000 UTC 3 C 2021-04-16 10:00:00.000 UTC 1

Advertisement