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
-
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 theCASE
expression twice, once for each new column (B and C in your example). Alternatively, you could create aSTRUCT
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 likeSELECT new_struct.B, new_struct.C
, where ‘new_struct’ is whatever name you decide to give your new struct column.