Questions tagged [cumulative-sum]

For questions regarding implementations or algorithms for calculating cumulative sums (also known as running totals). Always add the tag for the language/platform!

A cumulative sum (also known as a running total or partial sum) refers to the concept of maintaining only a single value (the sum), which is updated each time a new value is added to the sequence.

1433 questions
-1
votes
2 answers

Running Total C#

I'm creating a donation application that reads the input in a textbox, converts it to a double. Then using the method operatingCost, it should take that converted double and divide it by 17% (operating fees). Currently in the method, I have the…
Jeff Ryan
  • 19
  • 4
-1
votes
1 answer

How can I summarize in each row all the above rows?

Is it possible to get sum of all the above rows in each row? Example: Rows | Count 1. | 20 2. | 30 3. | 10 4. | 25 And I want to take the follow result Rows | TotalCount 1 | 20 (20) 2 | 50 (20+30) 3 | 60 (20+30+10) 4 | 85…
Yannis
  • 9
  • 1
-1
votes
1 answer

Running total with purchases and sales in query column

I have a table like below: How can I have a column like below using Transact-SQL (Order By Date)? I'm using SQL Server 2016.
Aryan
  • 9
  • 2
-1
votes
2 answers

Running total with condition in excel

I have the following 2-column table: Threshold Duration 1 1 1 2 1 1 0 1 0 2 1 1 1 3 I would like to create a column with running total of 'Duration' column which would start from 0…
Blazej Kowalski
  • 367
  • 1
  • 6
  • 16
-1
votes
3 answers

Group and sum values in associative array based on year substring in keys

I am trying to sum all of the yearly amounts based on an array with keys in a month-year ("M y") date format. $array_list = [ "Jan 2016" => 2, "Feb 2016" => 4, "Mar 2016" => 2, "Apr 2016" => 0, "Jan 2017" => 9, "Feb 2017" =>…
-1
votes
2 answers

Similar to Countifs and Sumifs in R

I should preface this... I cannot use dplyr. It is just not installing in my version of R. How would I do an action similar to a countifs or sumifs function in R? P1 | P2 | Match | Same | count_of_friends M | F | FALSE | FALSE| 6 M | M…
Kimberly
  • 69
  • 8
-1
votes
1 answer

R Generating Running Totals based on next 3 values

I am trying to generate a series by summing the next 3 values and next 4 values to calculate the forcast_leadtime and forecast weeks of supply in R. in the first row i have populated the expected values for both which is 1.008 & 1.64 respectively.…
S2850951
  • 182
  • 8
-1
votes
2 answers

How do i calculate running balance in SQL

I am using embedded derby database and I want to add running balance column by calculating debit and credit amounts so please tell me solution code and image are also available below (as you can see in image balance total is not accurate) SELECT…
Ali Ali
  • 1
  • 2
-1
votes
1 answer

MySQL cummulative sum

I have table like this one: FType | Vehicle | Driver | Time | QTY ---------------------------------------------- ED | 1 | A |20:57:51 | 5 ED | 1 | A |20:59:10 | 7 ED | 2 | B |20:58:40 | 6 …
Josef
  • 2,648
  • 5
  • 37
  • 73
-1
votes
1 answer

How to get asymptotic running time?

I do not know how to get exact Asymptotic Complexity as following question asks me to solve. Here is Question: Everything I learned from class is that, if there exists "for loop" that runs N times, or recursively call "recursive method" N times,…
-1
votes
1 answer

Excel: How to get total number of times substring occurs in a range

I have an excel document, and I want to be able to total the amount of times a substring (A name) occurs in that range. This is a picture of a table that I would want to use this formula on. Thanks for your help in advance
Greg Potts
  • 81
  • 5
-1
votes
1 answer

Subquery without additional column takes longer than with column

I'm trying to get a running total using a Subquery. (I'm using Metabase, which doesn't seem to accept/process variables in queries) My Query: SELECT date_format(t.`session_stop`, '%d') AS `session_stop`, sum(t.`energy_used` / 1000) AS `csum`, …
puredevotion
  • 1,135
  • 1
  • 11
  • 27
-1
votes
1 answer

Get sum on current subform

I have a "Mainform" in Microsoft Access that automatically computes the summation of my "Subform". Now my trouble is this, in my "Subform" there is a Yes/No check box that corresponds on Amount_Lent, Date and Name. I want to get the total summation…
-1
votes
1 answer

How to add only integer objects of 2 JSON arrays?

I have two JSON arrays with following values, var data1 = [{ "keyword": "Jan","PotentialAmmount": 450000,"EarnedAmmount": 250000}, { "keyword": "Feb","PotentialAmmount": 650000,"EarnedAmmount": 400000}, { "keyword":…
-1
votes
1 answer

Crystal Reports 2008 running total using datediff returns only 1

I have a running total set to count employees with less than 30 days between two events. While the report has groups, I have the running total set to never reset. I am using a formula in the Evaluate section that is as…
Avenestra
  • 1
  • 1