'Is it possible to calculate aggregate of an aggregate in BigQuery?
In BigQuery, is it possible to calculate aggregate of aggregate without using sub-queries? For example, Median of Max per user can be achieved by:
SELECT PERCENTILE_CONT(x, 0.5) FROM
(SELECT user_id, MAX(property) x FROM table GROUP BY 1)
If possible I would like to reduce this to
SELECT some_function FROM table
Reason for this request is to be able to integrate such queries into our BI tools. Our tools assume the source table is a fixed table and allow us grouping or filtering with dimensions. The initial approach requires a different sub-query definition for every filter and group by(ie. median of max per user per country).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
