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
-2
votes
1 answer

running total for N days with mysql

i have a table that looks like this : what i need is For each day show the accumulated (moving) number of new Droppers in the last 5 days inclusive Split to US vs. Non-US geos. Report Columns: DataTimstamp - upper boundary of a 5-day time…
Eliza R
  • 125
  • 1
  • 10
-2
votes
2 answers

Running total in R in a column with different values

A simplified version of my data looks like: year title name 2019 x a 2019 y b 2018 x a 2018 y a 2017 x c 2017 y a 2016 x a 2016 y b I would like to…
console.log
  • 177
  • 2
  • 16
-2
votes
3 answers

SQL: How to find top customers that pay 80% of revenue?

Let's say I have a table TRANSACTIONS: desc customer_transactions; +------------------------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra …
ipolevoy
  • 5,432
  • 2
  • 31
  • 46
-2
votes
1 answer

Drawing down budget

I have table for Users that contains a budget for training ID | UserID | FName | SName | Dept | Budget 1 | 1 | John | Smith | CS | 1000 2 | 2 | Ian | Caine | CS | 2500 3 | 3 | Jane | Kelly | ED | 1000 4 | 1 |…
Naz
  • 900
  • 2
  • 10
  • 25
-2
votes
1 answer

Display running total

Hi I was wondering if someone could explain how to to make this method diplay a running count and average, and not just display it once the user has finished entering its data? public void InScreen() { int count = 0; double total = 0.0; …
-2
votes
1 answer

How should we get cumulative columns for different types of variables?

my data is something like this: structure(c("Manufacturing Excell", "NPI Efficiencies", "NPI Efficiencies", "Manufacturing Excell", "Manufacturing Excell", "Material Efficiencie", "NPI Efficiencies", "Manufacturing Excell", "NPI Efficiencies",…
-2
votes
1 answer

Excel - running % of running total in pivot table

I have a table like: periodo quintil pos 201611 1 10 201611 2 20 201611 3 30 201611 4 40 201611 5 50 201612 1 9 201612 2 19 201612 3 29 201612 4 39 201612 5 49 I need to create a pivot table like: periodo quintil…
GabyLP
  • 3,649
  • 7
  • 45
  • 66
-2
votes
2 answers

Total variable won't update

I am newer to Java, so I am still trying to understand how to update variables properly. I am creating a program that acts as a restaurant menu. The listed menu items will appear on the left side, and once the user checks an item and clicks the…
CMoney
  • 3
  • 3
-2
votes
1 answer

daily production report with opeing and closing fields with grouping

I have to create a production report in SQL Server 2008 for my system, which includes datewise and employee wise/process wise grouping and issue/receive with it's opening and closing quantity/pcs. Here is my SQL Server table structure: CREATE…
-2
votes
1 answer

php cumulative time between time start and time end

Could anyone solve my problem please. I have mysql table with time_start 'hour:minute' and time_end 'hour:minute' how can i get cumulative time duration between time_start and time_end. thanks, $sel = $db->query("SELECT * FROM logbook WHERE date =…
Rdb
  • 59
  • 2
  • 12
-3
votes
1 answer

Running Total and Moving Average

What is the genre-wise running total and moving average of the average movie duration? -- (Note: You need to show the output table in the question.) /* Output format:…
-3
votes
1 answer

SQL Adding quantity of another column

I need to compute the sum of a column (B) in another column (C), but adding the next value and changing taking into account another column criteria (A), something like this: Is this possible with a simple SELECT?
Mazinger
  • 633
  • 1
  • 6
  • 12
-3
votes
2 answers

Subtracting previous row using mysql update

Table in database date amount name id 12-01 10.00 john doe 1002 12-02 10.00 john doe 1003 11-01 50.00 john doe 8976 11-02 50.00 john doe 8977 09-01 50.00 john doe 6788 09-02 50.00 john doe 6799 09-02 50.00 alicia…
Papsi Rhty
  • 13
  • 4
-3
votes
1 answer

How can I write my own R cumsum() function?

I am so new in R and want to write my own R cumsum() function. How can I create the function which takes in a length N vector of values to compute cumulative sums. Thanks
-3
votes
2 answers

Cumulative sum of Object type of values in Java

Suppose my value are in object type of array [1,2,3]. for(Object abc : entry.getValue()) { . . Object[] obj = (Object[]) abc ; (values are in abc) Now I want cumulative sum of obj[1], which I will put in another jsonObject. I know the logic for…
1 2 3
95
96