Learn business growth with Google Analytics 4 Forums Google Analytics 4 Identifying session-level traffic sources in BigQuery using CASE statements Reply To: Identifying session-level traffic sources in BigQuery using CASE statements

  • Jayden

    Member
    3 July 2023 at 7:14 pm

    Yes, that’s correct. In BigQuery, a CASE statement is typically used for creating a single column, not multiple ones. Therefore, your query won’t work as intended. However, you could run the CASE expression twice, once for each new column (B and C in your example). Alternatively, you could create a STRUCT type column with B and C as the fields. That way, you can do this all in one step. Later on you can easily select them using something like SELECT new_struct.B, new_struct.C, where ‘new_struct’ is whatever name you decide to give your new struct column.