Show calculation value from two cumulative sum series

Hello,
We have two data series from our factory:
A = Planned output (value = 1 every 15 minutes, otherwise empty)
B = Actual output (value = 1every time a product is finished, otherwise 0)
I show the actual output against the planned output in a graph using the cumulative sum for both. That works very good for any time frame like today, this week, year so far.
Now we would like to show if we fulfilled the planned output for the selected period as one number (in %).
The formula would be: (Latest value of cumulative sum Actual Output)/(Latest value of cumulative sum Planned output)
But as the latest value is never at the exact time this does not work. How can i achieve this calculation?
Thanks!