Total time to be displayed in single stat from a selected time interval

Hi, I’m new to grafana and unfortunately couldn’t find any help yet related to my topic. I’m using grafana version 5.3.4

I have a field that stores data in the Influxdb every 30 seconds. The field value is either 0 or 1. I have shared a graph where I can see the values is over the selected interval. Besides, I want to get the total number of hours and minutes over the interval where the value is 1 and display it in a single stat panel.
For example: In the graph, the value is 1 between 10-11 time period(If I select that particular period, in single stat it should show me 1 hour ). Is that possible somehow? I would appreciate some help, as I have no idea how to do this.

Thanks!