Getting accounting data from iptables (bytes) - display as bits/sec

I am getting IP accounting data from iptables output. This is in bytes (transferred data)
I collect this every 1 minute.
But I want to display average bandwidth usage , so in bits/sec.

What is the correct transformation & aggregation that I should use with the field on DB to display the average bits/sec according to the transferred bytes ?

So for example 60MB was downloaded in the last minute, I want to see as:
60/60 = 1MB/sec = 1024Mbits/sec

interesting that nobody has an answer to this.
seems like an easy problem. not too complex.
is it impossible ?

Assuming you use influx and influxql. I monitor a number of embedded devices which report data form ifconfig on different interfaces. $serial refers to the serial number in a drop down menu, replace with whatever identifier is appropriate for you.

The GROUP BY time(10s) in the inner select should be larger than your lowest reporting interval.

It’s been a while since I set this up. I belive the nested queries was needed to make sure that the counters did not wrap within the selected interval (embedded devices with small counters).

SELECT max("rxbytes") FROM
	(SELECT non_negative_derivative(mean("rx_bytes"), 1s) *8 as rxbytes FROM "wwan0" WHERE ("serial_number" =~ /^$serial$/) AND $timeFilter GROUP BY time(10s) fill(null))
GROUP BY time($__interval)