简体   繁体   中英

BigQuery : Daily averages for time series data

I have timeseries data for some routers in a network. I need to compute the daily throughput per category for data that looks like this. ( https://i.stack.imgur.com/PCvan.png )

Most of the examples online talk about moving averages over time. But I want the daily averages for every single day in the past year by router and network name. Something like

Expected output

I looked at AVG over a WINDOW. But it only gives the moving average for one fixed time period(1 day prior, 1 month prior etc). Is there a way for compute the averages for every single day in the year? Grouped by routerID and network name

Is this query what you need?

    SELECT
        DATE(ts) AS day,
        RouterID AS router_id,
        wifi_ssid,        
        AVERAGE(avg_kbps) AS average_bandwidth_for_day,
      FROM
        ts_table
  GROUP BY
        1, 2, 3

(if not, you will need to clarify your question)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM