Home > Enterprise >  Add derived column from existing column based on a condition in bigquery
Add derived column from existing column based on a condition in bigquery

Time:11-22

Suppose we have table below

user_id event_name event_time
Adam subscribe 1
Adam renewal 4
Adam renewal 5
Adam churn 7
Adam subscribe 10
Adam renewal 20

Notes:

  • event_time is actually in milliseconds but i just simplified things.
  • I asked a similar question and got a pretty good answer in here: enter image description here

  • Related