How calculate proportion between two values

Hello Forum,
So, I have an instance of influxdb running as backend to Grafana. On this DB I a collecting ping response time from a source to destination. My boss came with a great idea to calculate the reliability of the circuit for a specific period of time. So, the way I was thinking to do is the follow:

1-Take the number of entries (ping time written in the db) for a specific timeslot (let’ say 1 hour). For example let’ s say we have 3600 entries

2-Take the number of entry equal to 0 for the same timeslot (where basically there was packet drop). Let say we have 277 entries equal to 0

3- Calculate the proportion: 100:3600=x:277or even 277/3600. The result will be the percentage of packet drops (in this case 7.6 for the first case, or 0.076 for the second )

4- Subtract the above result to 100 and get the percentage value of ircuit reliability :slightly_smiling_face:
I need to “translate” the above in a Influxdb query or some sort that Grafana can understan and graph

SELECT (count("value") WHERE value = 0 / count("value") WHERE value != 0) * 100 FROM "ping_rtt" WHERE time < now() - 15

Hope Is clear