Graph difference between two series

I have two series with separate filters as per the image below. They represent how long a FULL transaction takes, and the second is the portion of that transaction where we’re waiting for a response from an external provider.

I need to graph the time that OUR system takes to process, which is the full time minus the time taken by the provider.

I can’t figure out how to do this. I’ve tried sub queries and if statements but nothing is working. Can anyone help?

You should probably take a look at kapacitor to create this new metric. As far as I know, summation / difference of different series is currently not supported within influxDB itself.