You can group by time 24h, give a local time zone and choose starting and ending dates at midnight by clicking on last 7 days or any other similar choice.
SELECT SUM("ifHCInOctets") AS "ifHCInOctets", SUM("ifHCOutOctets") AS "ifHCOutOctets", SUM("Total") AS "Total" FROM "measurement" WHERE $timefilter GROUP BY time(24h) fill(null) tz('America/Toronto')
If Total is not a field and it’s a calculation by adding the first two column, just do :
SELECT SUM("ifHCInOctets") AS "ifHCInOctets", SUM("ifHCOutOctets") AS "ifHCOutOctets", SUM("ifHCInOctets") + SUM("ifHCOutOctets") AS "Total" FROM "measurement" WHERE $timefilter GROUP BY time(24h) fill(null) tz('America/Toronto')
EDIT :
Since ifHCInOctets and ifHCOutOctets are counters, the suggested code is wrong but it would work for other types of data.
EDIT 2 :
I haven’t tested the code but I think you could do something like this for the first two columns :
SELECT SUM("nnd_ifHCInOctets") AS "ifHCInOctets", SUM("nnd_ifHCOutOctets") AS "ifHCOutOctets" FROM (SELECT non_negative_difference(max("ifHCInOctets")) AS "nnd_ifHCInOctets", non_negative_difference(max("ifHCOutOctets")) AS "nnd_ifHCOutOctets" FROM "measurement" WHERE $timefilter) WHERE $timefilter GROUP BY time(24h) fill(null) tz('America/Toronto')
First you calculate the difference to get the number of octets since the previous timestamp then you sum by 24h.