Hi,
in the select statement, we can easily do 5 xbar time.minute to group the data for every 5 minutes, what is the equivalent for doing like every 5 millisecond?
Hi,
in the select statement, we can easily do 5 xbar time.minute to group the data for every 5 minutes, what is the equivalent for doing like every 5 millisecond?
If you don’t cast to minutes first, you can explicitly group by millisecond (assuming your time column is a timestamp):
q)t:(time:.z.p+500000*til 20;col:til 20) q)select avg col by 5000000 xbar time from t // millisecond = 1000000 nanoseconds time | col -----------------------------| ---- 2022.09.09D03:50:38.425000000| 2.5 2022.09.09D03:50:38.430000000| 10.5 2022.09.09D03:50:38.435000000| 17.5
A timespan can be used directly
q)select avg col by 0D00:00:00.005 xbar time from t time | col -----------------------------| ---- 2022.09.09D07:40:23.110000000| 3 2022.09.09D07:40:23.115000000| 11.5 2022.09.09D07:40:23.120000000| 18
5 xbar `time$time