Kibana - Metricbeat Calculate time in application

I am trying to get a total time a user has spent in an application through metricbeat process.name field.

I am able to show the following, but cannot work out a way to calculate a total time in the application. Any ideas would be greatly appreciated.