Cumulative Sum by Epic per sprint

I’m trying to create cumulative sum by epic per sprint, as shown in the picture below.
The end goal is to calculate

  1. Number of epics include in 80% of completed story points
  2. The % completed Story point of top 3 epics (by size) out of total completed

currently trying to solve the first issue but appreciate help in any of the steps.