Я думаю, что вы ищете ниже
#standardSQL
WITH test AS (
SELECT * FROM UNNEST([
STRUCT('2019-10-26' AS DATE,'1.8025137' AS article_id, 'Digital Paying' AS user_type,'open' AS openmode, '123' AS uid),
('2019-10-26','1.8025137' , 'Digital Paying','close', '523'),
('2019-10-26','1.8025137' , 'Anonymous','open', '321'),
('2019-10-26','1.8025137' , 'Registered','close', '231'),
('2019-10-26','1.8025137' , 'Registered','open', '431'),
('2019-10-26','1.8025137' , 'Digital Paying','close', '132'),
('2019-10-26','1.8025137' , 'Anonymous','close', '111')
])
), users_agg AS (
SELECT DATE, article_id, user_type, openmode, COUNT(DISTINCT uid) AS uids
FROM test GROUP BY 1,2,3,4
), modes_agg AS (
SELECT DATE, article_id, user_type, ARRAY_AGG(STRUCT(openmode, uids)) AS modes
FROM users_agg GROUP BY 1,2,3
), types_agg AS (
SELECT DATE, article_id, ARRAY_AGG(STRUCT(user_type, modes)) types
FROM modes_agg GROUP BY 1,2
), article_agg AS (
SELECT DATE, ARRAY_AGG(STRUCT(article_id, types)) articles
FROM types_agg GROUP BY 1
)
SELECT *
FROM article_agg
с результатом